alpha: Update libm-test-ulps from scratch
[glibc.git] / configure.in
blobcf118f8ffa3020fdbce27436e5aab945190f56d1
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])
153 AC_ARG_ENABLE([versioning],
154               AC_HELP_STRING([--disable-versioning],
155                              [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
156               [enable_versioning=$enableval],
157               [enable_versioning=yes])
159 AC_ARG_ENABLE([oldest-abi],
160               AC_HELP_STRING([--enable-oldest-abi=ABI],
161                              [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
162               [oldest_abi=$enableval],
163               [oldest_abi=no])
164 if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
165   oldest_abi=default
166 else
167   AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
169 AC_SUBST(oldest_abi)
171 AC_ARG_ENABLE([hardcoded-path-in-tests],
172               AC_HELP_STRING([--enable-hardcoded-path-in-tests],
173                              [hardcode newly built glibc path in tests @<:@default=no@:>@]),
174               [hardcoded_path_in_tests=$enableval],
175               [hardcoded_path_in_tests=no])
176 AC_SUBST(hardcoded_path_in_tests)
178 AC_ARG_ENABLE([stackguard-randomization],
179               AC_HELP_STRING([--enable-stackguard-randomization],
180                              [initialize __stack_chk_guard canary with a random number at program start]),
181               [enable_stackguard_randomize=$enableval],
182               [enable_stackguard_randomize=no])
183 if test "$enable_stackguard_randomize" = yes; then
184   AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
187 AC_ARG_ENABLE([lock-elision],
188               AC_HELP_STRING([--enable-lock-elision[=yes/no]],
189                              [Enable lock elision for pthread mutexes and rwlocks by default]),
190               [enable_lock_elision=$enableval],
191               [enable_lock_elision=no])
192 if test "$enable_lock_elision" = yes ; then
193   AC_DEFINE(ENABLE_LOCK_ELISION)
196 dnl Generic infrastructure for drop-in additions to libc.
197 AC_ARG_ENABLE([add-ons],
198               AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
199                              [configure and build add-ons in DIR1,DIR2,...
200                               search for add-ons if no parameter given]),
201                              , [enable_add_ons=yes])
203 AC_ARG_ENABLE([hidden-plt],
204               AC_HELP_STRING([--disable-hidden-plt],
205                              [do not hide internal function calls to avoid PLT]),
206               [hidden=$enableval],
207               [hidden=yes])
208 if test "x$hidden" = xno; then
209   AC_DEFINE(NO_HIDDEN)
212 AC_ARG_ENABLE([bind-now],
213               AC_HELP_STRING([--enable-bind-now],
214                              [disable lazy relocations in DSOs]),
215               [bindnow=$enableval],
216               [bindnow=no])
217 AC_SUBST(bindnow)
219 dnl On some platforms we cannot use dynamic loading.  We must provide
220 dnl static NSS modules.
221 AC_ARG_ENABLE([static-nss],
222               AC_HELP_STRING([--enable-static-nss],
223                              [build static NSS modules @<:@default=no@:>@]),
224               [static_nss=$enableval],
225               [static_nss=no])
226 dnl Enable static NSS also if we build no shared objects.
227 if test x"$static_nss" = xyes || test x"$shared" = xno; then
228   static_nss=yes
229   AC_DEFINE(DO_STATIC_NSS)
232 AC_ARG_ENABLE([force-install],
233               AC_HELP_STRING([--disable-force-install],
234                              [don't force installation of files from this package, even if they are older than the installed files]),
235               [force_install=$enableval],
236               [force_install=yes])
237 AC_SUBST(force_install)
239 dnl On some platforms we allow dropping compatibility with all kernel
240 dnl versions.
241 AC_ARG_ENABLE([kernel],
242               AC_HELP_STRING([--enable-kernel=VERSION],
243                              [compile for compatibility with kernel not older than VERSION]),
244               [minimum_kernel=$enableval],
245               [])
246 dnl Prevent unreasonable values.
247 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
248   # Better nothing than this.
249   minimum_kernel=""
250 else
251   if test "$minimum_kernel" = current; then
252     minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
253   fi
256 dnl For the development we sometimes want gcc to issue even more warnings.
257 dnl This is not the default since many of the extra warnings are not
258 dnl appropriate.
259 AC_ARG_ENABLE([all-warnings],
260               AC_HELP_STRING([--enable-all-warnings],
261                              [enable all useful warnings gcc can issue]),
262               [all_warnings=$enableval],
263               [])
264 AC_SUBST(all_warnings)
266 AC_ARG_ENABLE([multi-arch],
267               AC_HELP_STRING([--enable-multi-arch],
268                              [enable single DSO with optimizations for multiple architectures]),
269               [multi_arch=$enableval],
270               [multi_arch=default])
272 AC_ARG_ENABLE([nss-crypt],
273               AC_HELP_STRING([--enable-nss-crypt],
274                              [enable libcrypt to use nss]),
275               [nss_crypt=$enableval],
276               [nss_crypt=no])
277 if test x$nss_crypt = xyes; then
278   nss_includes=-I$(nss-config --includedir 2>/dev/null)
279   if test $? -ne 0; then
280     AC_MSG_ERROR([cannot find include directory with nss-config])
281   fi
282   old_CFLAGS="$CFLAGS"
283   CFLAGS="$CFLAGS $nss_includes"
284   AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
285 #include <hasht.h>
286 #include <nsslowhash.h>
287 void f (void) { NSSLOW_Init (); }])],
288              libc_cv_nss_crypt=yes,
289              AC_MSG_ERROR([
290 cannot find NSS headers with lowlevel hash function interfaces]))
291   old_LIBS="$LIBS"
292   LIBS="$LIBS -lfreebl3"
293   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
294 #include <hasht.h>
295 #include <nsslowhash.h>],
296                                   [NSSLOW_Init();])],
297                  libc_cv_nss_crypt=yes,
298                  AC_MSG_ERROR([
299 cannot link program using lowlevel NSS hash functions]))
300   CFLAGS="$old_CFLAGS"
301   LIBS="$old_LIBS"
302 else
303   libc_cv_nss_crypt=no
305 AC_SUBST(libc_cv_nss_crypt)
308 AC_ARG_ENABLE([obsolete-rpc],
309               AC_HELP_STRING([--enable-obsolete-rpc],
310                              [build and install the obsolete RPC code for link-time usage]),
311               [link_obsolete_rpc=$enableval],
312               [link_obsolete_rpc=no])
313 AC_SUBST(link_obsolete_rpc)
315 if test "$link_obsolete_rpc" = yes; then
316   AC_DEFINE(LINK_OBSOLETE_RPC)
319 AC_ARG_ENABLE([systemtap],
320               [AS_HELP_STRING([--enable-systemtap],
321                [enable systemtap static probe points @<:@default=no@:>@])],
322               [systemtap=$enableval],
323               [systemtap=no])
324 if test "x$systemtap" != xno; then
325   AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
326   old_CFLAGS="$CFLAGS"
327   CFLAGS="-std=gnu99 $CFLAGS"
328   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
329 void foo (int i, void *p)
331   asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
332        :: STAP_PROBE_ASM_OPERANDS (2, i, p));
333 }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
334   CFLAGS="$old_CFLAGS"])
335   if test $libc_cv_sdt = yes; then
336     AC_DEFINE([USE_STAP_PROBE])
337   elif test "x$systemtap" != xauto; then
338     AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
339   fi
342 AC_ARG_ENABLE([build-nscd],
343               [AS_HELP_STRING([--disable-build-nscd],
344                [disable building and installing the nscd daemon])],
345               [build_nscd=$enableval],
346               [build_nscd=default])
347 AC_SUBST(build_nscd)
349 # Note the use of $use_nscd is near the bottom of the file.
350 AC_ARG_ENABLE([nscd],
351               [AS_HELP_STRING([--disable-nscd],
352                [library functions will not contact the nscd daemon])],
353               [use_nscd=$enableval],
354               [use_nscd=yes])
356 # The way shlib-versions is used to generate soversions.mk uses a
357 # fairly simplistic model for name recognition that can't distinguish
358 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
359 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
360 # tell.  This doesn't get used much beyond that, so it's fairly safe.
361 case "$host_os" in
362 linux*)
363   ;;
364 gnu*)
365   host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
366   ;;
367 esac
369 # We keep the original values in `$config_*' and never modify them, so we
370 # can write them unchanged into config.make.  Everything else uses
371 # $machine, $vendor, and $os, and changes them whenever convenient.
372 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
374 # Don't allow vendor == "unknown"
375 test "$config_vendor" = unknown && config_vendor=
376 config_os="`echo $config_os | sed 's/^unknown-//'`"
378 # Some configurations imply other options.
379 elf=yes
381 # The configure fragment of an add-on port can modify these to supplement
382 # or override the table in the case statement below.  No fragment should
383 # ever change the config_* variables, however.
384 machine=$config_machine
385 vendor=$config_vendor
386 os=$config_os
387 base_os=''
389 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
390 # Unify this here.
391 if test "$machine" = rs6000; then
392   machine="powerpc"
395 # Braindead PowerPC box with absolutely no FPU.
396 case "$machine-$host_os" in
397   powerpc*-*soft)
398     with_fp=no
399     ;;
400 esac
402 submachine=
403 AC_ARG_WITH([cpu],
404             AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
405             [dnl
406   case "$withval" in
407   yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
408   no) ;;
409   *) submachine="$withval" ;;
410   esac
413 dnl Let sysdeps/*/preconfigure act here, like they can in add-ons.
414 LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
416 # An add-on can set this when it wants to disable the sanity check below.
417 libc_config_ok=no
419 dnl Having this here, though empty, makes sure that if add-ons' fragments
420 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
421 dnl our AC_OUTPUT will actually use it.
422 AC_CONFIG_SUBDIRS()
424 case "$enable_add_ons" in
425 ''|no) add_ons= ;;
426 yes|'*')
427  add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
428           sed 's@/[[^/]]*$@@' | sort | uniq`
429          add_ons_automatic=yes
430          ;;
431 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
432        add_ons_automatic=no ;;
433 esac
435 configured_add_ons=
436 add_ons_sfx=
437 add_ons_pfx=
438 if test x"$add_ons" != x; then
439   for f in $add_ons; do
440     # Some sanity checks
441     case "$f" in
442     crypt)
443       AC_MSG_ERROR([
444 *** It seems that you're using an old \`crypt' add-on.  crypt is now
445 *** part of glibc and using the old add-on will not work with this
446 *** release.  Start again with fresh sources and without the old
447 *** \`crypt' add-on.])
448     ;;
449     localedata)
450       AC_MSG_ERROR([
451 *** It seems that you're using an old \`localedata' add-on.  localedata
452 *** is now part of glibc and using the old add-on will not work with
453 *** this release.  Start again with fresh sources and without the old
454 *** \`localedata' add-on.])
455     ;;
456     esac
457   done
459   # Now source each add-on's configure fragment.
460   # The fragments can use $srcdir/$libc_add_on to find themselves,
461   # and test $add_ons_automatic to see if they were explicitly requested.
462   # A fragment can clear (or even change) $libc_add_on to affect
463   # whether it goes into the list to be actually used in the build.
464   use_add_ons=
465   for libc_add_on in $add_ons; do
466     # Test whether such a directory really exists.
467     # It can be absolute, or relative to $srcdir, or relative to the build dir.
468     case "$libc_add_on" in
469     /*)
470       libc_add_on_srcdir=$libc_add_on
471       ;;
472     *)
473       test -d "$srcdir/$libc_add_on" || {
474         if test -d "$libc_add_on"; then
475           libc_add_on="`pwd`/$libc_add_on"
476         else
477           AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
478         fi
479       }
480       libc_add_on_srcdir=$srcdir/$libc_add_on
481       ;;
482     esac
484     libc_add_on_frag=$libc_add_on_srcdir/configure
485     libc_add_on_canonical=
486     libc_add_on_config_subdirs=
487     if test -r "$libc_add_on_frag"; then
488       AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
489       libc_add_on_canonical=unknown
490       libc_add_on_subdirs=
491       . "$libc_add_on_frag"
492       test -z "$libc_add_on" || {
493         configured_add_ons="$configured_add_ons $libc_add_on"
494         if test "x$libc_add_on_canonical" = xunknown; then
495           AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
496         fi
497         for d in $libc_add_on_subdirs; do
498           case "$libc_add_on" in
499           /*) subdir_srcdir="$libc_add_on" ;;
500           *) subdir_srcdir="\$(..)$libc_add_on" ;;
501           esac
502           case "$d" in
503           .)
504             d="${libc_add_on_canonical:-$libc_add_on}"
505             ;;
506           /*)
507             subdir_srcdir="$d"
508             ;;
509           *)
510             subdir_srcdir="$subdir_srcdir/$d"
511             ;;
512           esac
513           d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
514           add_on_subdirs="$add_on_subdirs $d"
515           test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
516 $d-srcdir = $subdir_srcdir"
517         done
518         for d in $libc_add_on_config_subdirs; do
519           case "$d" in
520           /*) AC_MSG_ERROR(dnl
521 fragment uses absolute path in \$libc_add_on_config_subdirs) ;;
522           esac
523           if test ! -d "$libc_add_on_srcdir/$d"; then
524             AC_MSG_ERROR(fragment wants to configure missing directory $d)
525           fi
526           case "$libc_add_on" in
527           /*) AC_MSG_ERROR(dnl
528 relative path required for add-on using \$libc_add_on_config_subdirs) ;;
529           esac
530           subdirs="$subdirs $libc_add_on/$d"
531         done
532       }
533     fi
534     if test -n "$libc_add_on"; then
535       LIBC_PRECONFIGURE([$libc_add_on_srcdir], [add-on $libc_add_on for])
536       use_add_ons="$use_add_ons $libc_add_on"
537       add_ons_pfx="$add_ons_pfx $libc_add_on/"
538       test -z "$libc_add_on_canonical" ||
539       add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
540     fi
541   done
542   # Use echo to strip excess whitespace.
543   add_ons="`echo $use_add_ons`"
545 AC_SUBST(add_ons)
546 AC_SUBST(add_on_subdirs)
550 ### I put this here to prevent those annoying emails from people who cannot
551 ### read and try to compile glibc on unsupported platforms.  --drepper
553 ### By using the undocumented --enable-hacker-mode option for configure
554 ### one can skip this test to make the configuration not fail for unsupported
555 ### platforms.
557 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
558   case "$machine-$host_os" in
559   *-linux* | *-gnu*)
560     ;;
561   *)
562     echo "*** The GNU C library is currently not available for this platform."
563     echo "*** So far nobody cared to port it and if there is no volunteer it"
564     echo "*** might never happen.  So, if you have interest to see glibc on"
565     echo "*** this platform visit"
566     echo "***   http://www.gnu.org/software/libc/porting.html"
567     echo "*** and join the group of porters"
568     exit 1
569     ;;
570   esac
573 dnl We need to use [ and ] for other purposes for a while now.
574 changequote(,)dnl
575 # Expand the configuration machine name into a subdirectory by architecture
576 # type and particular chip.  If an add-on configure fragment already set
577 # base_machine, we don't change it.
578 test -n "$base_machine" || case "$machine" in
579 i[4567]86)      base_machine=i386 machine=i386/$machine ;;
580 powerpc)        base_machine=powerpc machine=powerpc/powerpc32 ;;
581 powerpc64)      base_machine=powerpc machine=powerpc/powerpc64 ;;
582 s390)           base_machine=s390 machine=s390/s390-32 ;;
583 s390x)          base_machine=s390 machine=s390/s390-64 ;;
584 sh3*)           base_machine=sh machine=sh/sh3 ;;
585 sh4*)           base_machine=sh machine=sh/sh4 ;;
586 sparc | sparcv[67])
587                 base_machine=sparc machine=sparc/sparc32 ;;
588 sparcv8 | supersparc | hypersparc)
589                 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
590 sparcv8plus | sparcv8plusa | sparcv9)
591                 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
592 sparcv8plusb | sparcv9b)
593                 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
594 sparcv9v)
595                 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
596 sparcv9v2)
597                 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
598 sparc64)
599                 base_machine=sparc machine=sparc/sparc64 ;;
600 sparc64b)
601                 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
602 sparc64v)
603                 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
604 sparc64v2)
605                 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
606 *)              base_machine=$machine ;;
607 esac
608 changequote([,])dnl
609 AC_SUBST(base_machine)
611 if test "$base_machine" = "i386"; then
612   AC_DEFINE(USE_REGPARMS)
615 # For the multi-arch option we need support in the assembler & linker.
616 AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
617                libc_cv_ld_gnu_indirect_function, [dnl
618 cat > conftest.S <<EOF
619 .type foo,%gnu_indirect_function
620 foo:
621 .globl _start
622 _start:
623 .globl __start
624 __start:
625 .data
626 #ifdef _LP64
627 .quad foo
628 #else
629 .long foo
630 #endif
632 libc_cv_ld_gnu_indirect_function=no
633 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
634             -nostartfiles -nostdlib \
635             -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
636   # Do a link to see if the backend supports IFUNC relocs.
637   $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
638   LC_ALL=C $READELF -r conftest | grep 'no relocations' >/dev/null || {
639     libc_cv_ld_gnu_indirect_function=yes
640   }
642 rm -f conftest*])
644 AC_MSG_CHECKING(whether .text pseudo-op must be used)
645 AC_CACHE_VAL(libc_cv_dot_text, [dnl
646 cat > conftest.s <<EOF
647 .text
649 libc_cv_dot_text=
650 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
651   libc_cv_dot_text=.text
653 rm -f conftest*])
654 if test -z "$libc_cv_dot_text"; then
655   AC_MSG_RESULT(no)
656 else
657   AC_MSG_RESULT(yes)
660 if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
661   if test x"$multi_arch" = xyes; then
662     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
663   else
664     multi_arch=no
665   fi
667 multi_arch_d=
668 if test x"$multi_arch" != xno; then
669   multi_arch_d=/multiarch
672 # Compute the list of sysdep directories for this configuration.
673 # This can take a while to compute.
674 sysdep_dir=$srcdir/sysdeps
675 AC_MSG_CHECKING(sysdep dirs)
676 dnl We need to use [ and ] for other purposes for a while now.
677 changequote(,)dnl
678 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
679 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
681 test "x$base_os" != x || case "$os" in
682 gnu*)
683   base_os=mach/hurd ;;
684 linux*)
685   base_os=unix/sysv ;;
686 esac
688 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
689 tail=$os
690 ostry=$os
691 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
692   ostry="$ostry /$o"
693   tail=$o
694 done
695 o=`echo $tail | sed 's/[0-9]*$//'`
696 if test $o != $tail; then
697   ostry="$ostry /$o"
699 # For linux-gnu, try linux-gnu, then linux.
700 o=`echo $tail | sed 's/-.*$//'`
701 if test $o != $tail; then
702   ostry="$ostry /$o"
705 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
706 base=
707 tail=$base_os
708 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
709   set $b
710   base="$base /$1"
711   tail="$2"
712 done
714 # For sparc/sparc32, try sparc/sparc32 and then sparc.
715 mach=
716 tail=$machine${submachine:+/$submachine}
717 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
718   set $m
719   # Prepend the machine's FPU directory unless --without-fp.
720   if test "$with_fp" = yes; then
721     maybe_fpu=/fpu
722   else
723     maybe_fpu=/nofpu
724   fi
725   # For each machine term, try it with and then without /multiarch.
726   for try_fpu in $maybe_fpu ''; do
727     for try_multi in $multi_arch_d ''; do
728       mach="$mach /$1$try_fpu$try_multi"
729     done
730   done
731   tail="$2"
732 done
734 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
735 changequote([,])dnl
737 # Find what sysdep directories exist.
738 sysnames_add_ons=
739 sysnames=
740 for b in $base ''; do
741   for m0 in $mach ''; do
742     for v in /$vendor ''; do
743       test "$v" = / && continue
744       for o in /$ostry ''; do
745         test "$o" = / && continue
746         for m in $mach ''; do
747           for d in $add_ons_pfx ''; do
748             for a in $add_ons_sfx ''; do
749               try_suffix="$m0$b$v$o$m"
750               if test -n "$try_suffix"; then
751                 try_srcdir="${srcdir}/"
752                 case "$d" in
753                 /*) try_srcdir= ;;
754                 esac
755                 try="${d}sysdeps$try_suffix$a"
756                 test -n "$enable_debug_configure" &&
757                 echo "$0 [DEBUG]: try $try" >&2
758                 if test -d "$try_srcdir$try"; then
759                   sysnames="$sysnames $try"
760                   { test -n "$o" || test -n "$b"; } && os_used=t
761                   { test -n "$m" || test -n "$m0"; } && machine_used=t
762                   case x${m0:-$m} in
763                   x*/$submachine) submachine_used=t ;;
764                   esac
765                   if test -n "$d"; then
766                     case "$sysnames_add_ons" in
767                     *" $d "*) ;;
768                     *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
769                     esac
770                   fi
771                 fi
772               fi
773             done
774           done
775         done
776       done
777     done
778   done
779 done
781 # If the assembler supports gnu_indirect_function symbol type and the
782 # architecture supports multi-arch, we enable multi-arch by default.
783 case $sysnames_add_ons$sysnames in
784 *"$multi_arch_d"*)
785   ;;
787   test x"$multi_arch" = xdefault && multi_arch=no
788   ;;
789 esac
790 if test x"$multi_arch" != xno; then
791   AC_DEFINE(USE_MULTIARCH)
793 AC_SUBST(multi_arch)
795 if test -z "$os_used" && test "$os" != none; then
796   AC_MSG_ERROR(Operating system $os is not supported.)
798 if test -z "$machine_used" && test "$machine" != none; then
799   AC_MSG_ERROR(The $machine is not supported.)
801 if test -z "$submachine_used" && test -n "$submachine"; then
802   AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
804 AC_SUBST(submachine)
806 # We have now validated the configuration.
808 # Expand the list of system names into a full list of directories
809 # from each element's parent name and Implies file (if present).
810 set $sysnames
811 names=
812 while test $# -gt 0; do
813   name=$1
814   shift
816   case " $names " in *" $name "*)
817     # Already in the list.
818     continue
819   esac
821   # Report each name as we discover it, so there is no long pause in output.
822   echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
824   name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
826   case $name in
827     /*) xsrcdir= ;;
828     *)  xsrcdir=$srcdir/ ;;
829   esac
830   test -n "$enable_debug_configure" &&
831   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
833   for implies_file in Implies Implies-before Implies-after; do
834     implies_type=`echo $implies_file | sed s/-/_/`
835     eval ${implies_type}=
836     if test -f $xsrcdir$name/$implies_file; then
837       # Collect more names from the `Implies' file (removing comments).
838       implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
839       for x in $implied_candidate; do
840         found=no
841         if test -d $xsrcdir$name_base/$x; then
842           eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
843           found=yes
844         fi
845         for d in $add_ons_pfx ''; do
846           try="${d}sysdeps/$x"
847           case $d in
848            /*) try_srcdir= ;;
849            *) try_srcdir=$srcdir/ ;;
850           esac
851           test -n "$enable_debug_configure" &&
852            echo "[DEBUG]: $name $implies_file $x try($d) {$try_srcdir}$try" >&2
853           if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
854           then
855             eval "${implies_type}=\"\$${implies_type} \$try\""
856             found=yes
857             case "$sysnames_add_ons" in
858             *" $d "*) ;;
859             *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
860             esac
861           fi
862         done
863         if test $found = no; then
864           AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
865         fi
866       done
867     fi
868   done
870   # Add NAME to the list of names.
871   names="$names $name"
873   # Find the parent of NAME, using the empty string if it has none.
874 changequote(,)dnl
875   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
876 changequote([,])dnl
878   test -n "$enable_debug_configure" &&
879     echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
880 Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
882   # Add the names implied by NAME, and NAME's parent (if it has one), to
883   # the list of names to be processed (the argument list).  We prepend the
884   # implied names to the list and append the parent.  We want implied
885   # directories to come before further directories inferred from the
886   # configuration components; this ensures that for sysv4, unix/common
887   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
888   # after sysv4).
889   sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
890   test -n "$sysnames" && set $sysnames
891 done
893 # Add the default directories.
894 default_sysnames="sysdeps/generic"
895 sysnames="$names $default_sysnames"
896 AC_SUBST(sysnames)
897 # The other names were emitted during the scan.
898 AC_MSG_RESULT($default_sysnames)
900 # Collect the list of add-ons that supply partial sysdeps trees.
901 sysdeps_add_ons=
902 for add_on in $add_ons; do
903   case "$add_on" in
904   /*) xsrcdir= ;;
905   *) xsrcdir="$srcdir/" ;;
906   esac
908   test -d "$xsrcdir$add_on/sysdeps" || {
909     case "$configured_add_ons " in
910     *" $add_on "*) ;;
911     *|'')
912       AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
913       ;;
914     esac
915     continue
916   }
918   sysdeps_add_ons="$sysdeps_add_ons $add_on"
919   case "$sysnames_add_ons" in
920   *" $add_on/ "*) ;;
921   *|'')
922     AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
923     continue ;;
924   esac
926   found=no
927   for d in $sysnames; do
928     case "$d" in
929     $add_on/sysdeps/*) ;;
930     *) continue ;;
931     esac
932     (cd "$xsrcdir$d" && for f in *[[!~]]; do
933        case "$f" in
934        sys|bits)
935          for ff in $f/*.h; do
936            test -d "$ff" || { test -e "$ff" && exit 88; }
937          done
938          ;;
939        *)
940          test -d "$f" || { test -e "$f" && exit 88; }
941          ;;
942        esac
943      done)
944     if test $? -eq 88; then
945       found=yes
946       break
947     fi
948   done
949   if test $found = no; then
950     AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
951   fi
952 done
953 AC_SUBST(sysdeps_add_ons)
956 ### Locate tools.
958 AC_PROG_INSTALL
959 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
960   # The makefiles need to use a different form to find it in $srcdir.
961   INSTALL='\$(..)./scripts/install-sh -c'
963 AC_PROG_LN_S
965 LIBC_PROG_BINUTILS
967 # Accept binutils 2.20 or newer.
968 AC_CHECK_PROG_VER(AS, $AS, --version,
969                   [GNU assembler.* \([0-9]*\.[0-9.]*\)],
970                   [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], AS=: critic_missing="$critic_missing as")
971 AC_CHECK_PROG_VER(LD, $LD, --version,
972                   [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
973                   [2.1[0-9][0-9]*|2.[2-9][0-9]*|[3-9].*|[1-9][0-9]*], LD=: critic_missing="$critic_missing ld")
975 # These programs are version sensitive.
976 AC_CHECK_TOOL_PREFIX
977 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
978   [version \([egcygnustpi-]*[0-9.]*\)], [4.[4-9].* | 4.[1-9][0-9].* | [5-9].* ],
979   critic_missing="$critic_missing gcc")
980 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
981   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
982   [3.79* | 3.[89]*], critic_missing="$critic_missing make")
984 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
985   [GNU gettext.* \([0-9]*\.[0-9.]*\)],
986   [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
987   MSGFMT=: aux_missing="$aux_missing msgfmt")
988 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
989   [GNU texinfo.* \([0-9][0-9.]*\)],
990   [4.[5-9]*|4.[1-9][0-9]*|[5-9].*],
991   MAKEINFO=: aux_missing="$aux_missing makeinfo")
992 AC_CHECK_PROG_VER(SED, sed, --version,
993   [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
994   [3.0[2-9]*|3.[1-9]*|[4-9]*],
995   SED=: aux_missing="$aux_missing sed")
996 AC_CHECK_PROG_VER(AWK, gawk, --version,
997   [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
998   [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
1000 AC_CHECK_TOOL(NM, nm, false)
1002 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
1003 case "x$AUTOCONF" in
1004 xno|x|x:) AUTOCONF=no ;;
1006   AC_CACHE_CHECK(dnl
1007 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
1008   if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
1009     libc_cv_autoconf_works=yes
1010   else
1011     libc_cv_autoconf_works=no
1012   fi])
1013   test $libc_cv_autoconf_works = yes || AUTOCONF=no
1014   ;;
1015 esac
1016 if test "x$AUTOCONF" = xno; then
1017   aux_missing="$aux_missing autoconf"
1020 test -n "$critic_missing" && AC_MSG_ERROR([
1021 *** These critical programs are missing or too old:$critic_missing
1022 *** Check the INSTALL file for required versions.])
1024 test -n "$aux_missing" && AC_MSG_WARN([
1025 *** These auxiliary programs are missing or incompatible versions:$aux_missing
1026 *** some features will be disabled.
1027 *** Check the INSTALL file for required versions.])
1029 # if using special system headers, find out the compiler's sekrit
1030 # header directory and add that to the list.  NOTE: Only does the right
1031 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
1032 if test -n "$sysheaders"; then
1033   SYSINCLUDES=-nostdinc
1034   for d in include include-fixed; do
1035     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
1036     SYSINCLUDES="$SYSINCLUDES -isystem $i"
1037   done
1038   SYSINCLUDES="$SYSINCLUDES \
1039 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
1040   if test -n "$CXX"; then
1041     CXX_SYSINCLUDES=
1042     for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
1043     | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
1044       test "x$cxxheaders" != x &&
1045       CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
1046     done
1047   fi
1049 AC_SUBST(SYSINCLUDES)
1050 AC_SUBST(CXX_SYSINCLUDES)
1052 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1053 # since this would lead to problems installing/building glibc.
1054 # LD_LIBRARY_PATH contains the current directory if one of the following
1055 # is true:
1056 # - one of the terminals (":" and ";") is the first or last sign
1057 # - two terminals occur directly after each other
1058 # - the path contains an element with a dot in it
1059 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1060 changequote(,)dnl
1061 case ${LD_LIBRARY_PATH} in
1062   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1063     ld_library_path_setting="contains current directory"
1064     ;;
1065   *)
1066     ld_library_path_setting="ok"
1067     ;;
1068 esac
1069 changequote([,])dnl
1070 AC_MSG_RESULT($ld_library_path_setting)
1071 if test "$ld_library_path_setting" != "ok"; then
1072 AC_MSG_ERROR([
1073 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1074 *** building glibc. Please change the environment variable
1075 *** and run configure again.])
1078 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1079 if $CC -v -static-libgcc 2>&1 | grep 'unrecognized option.*static-libgcc' >/dev/null; then
1080   libc_cv_gcc_static_libgcc=
1081 else
1082   libc_cv_gcc_static_libgcc=-static-libgcc
1083 fi])
1084 AC_SUBST(libc_cv_gcc_static_libgcc)
1086 AC_PATH_PROG(BASH_SHELL, bash, no)
1087 if test "$BASH_SHELL" != no &&
1088    $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1089              && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1090   libc_cv_have_bash2=yes
1091 else
1092   libc_cv_have_bash2=no
1094 AC_SUBST(libc_cv_have_bash2)
1096 dnl We need a ksh compatible shell for tzselect.
1097 if test "$BASH_SHELL" = no; then
1098   AC_PATH_PROG(KSH, ksh, no)
1099   if test "$KSH" = no; then
1100     libc_cv_have_ksh=no
1101   else
1102     libc_cv_have_ksh=yes
1103   fi
1104 else
1105   KSH="$BASH_SHELL"
1106   AC_SUBST(KSH)
1107   libc_cv_have_ksh=yes
1109 AC_SUBST(libc_cv_have_ksh)
1111 AC_PATH_PROG(PERL, perl, no)
1112 if test "$PERL" != no &&
1113    (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1114   PERL=no
1116 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1117              $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1118 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1120 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1121 AC_TRY_COMPILE(dnl
1122 [#define __need_size_t
1123 #define __need_wchar_t
1124 #include <stddef.h>
1125 #define __need_NULL
1126 #include <stddef.h>], [size_t size; wchar_t wchar;
1127 #ifdef offsetof
1128 #error stddef.h ignored __need_*
1129 #endif
1130 if (&size == NULL || &wchar == NULL) abort ();],
1131                libc_cv_friendly_stddef=yes,
1132                libc_cv_friendly_stddef=no)])
1133 if test $libc_cv_friendly_stddef = yes; then
1134   config_vars="$config_vars
1135 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1138 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1139                libc_cv_need_minus_P, [dnl
1140 cat > conftest.S <<EOF
1141 #include "confdefs.h"
1142 /* Nothing whatsoever.  */
1144 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1145   libc_cv_need_minus_P=no
1146 else
1147   libc_cv_need_minus_P=yes
1149 rm -f conftest*])
1150 if test $libc_cv_need_minus_P = yes; then
1151   config_vars="$config_vars
1152 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1155 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1156 cat > conftest.s <<EOF
1157 ${libc_cv_dot_text}
1158 foo:
1159 .set glibc_conftest_frobozz,foo
1160 .globl glibc_conftest_frobozz
1162 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1163 # (but it doesn't work), so we must do a linking check to be sure.
1164 cat > conftest1.c <<\EOF
1165 extern int glibc_conftest_frobozz;
1166 void _start() { glibc_conftest_frobozz = 1; }
1168 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1169             -nostartfiles -nostdlib \
1170             -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1171   libc_cv_asm_set_directive=yes
1172 else
1173   libc_cv_asm_set_directive=no
1175 rm -f conftest*])
1176 if test $libc_cv_asm_set_directive = yes; then
1177   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1180 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1181                libc_cv_asm_unique_object, [dnl
1182 cat > conftest.s <<EOF
1183 ${libc_cv_dot_text}
1184 _sym:
1185 .type _sym, %gnu_unique_object
1187 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1188   libc_cv_asm_unique_object=yes
1189 else
1190   libc_cv_asm_unique_object=no
1192 rm -f conftest*])
1193 if test $libc_cv_asm_unique_object = yes; then
1194   AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1197 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1198 [cat > conftest.s <<EOF
1199 ${libc_cv_dot_text}
1200 _sym:
1201 .symver _sym,sym@VERS
1203 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1204   libc_cv_asm_symver_directive=yes
1205 else
1206   libc_cv_asm_symver_directive=no
1208 rm -f conftest*])
1209 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1210 if test $libc_cv_asm_symver_directive = yes; then
1211   cat > conftest.s <<EOF
1212 ${libc_cv_dot_text}
1213 _sym:
1214 .symver _sym,sym@VERS
1216   cat > conftest.map <<EOF
1217 VERS_1 {
1218         global: sym;
1221 VERS_2 {
1222         global: sym;
1223 } VERS_1;
1225   if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1226     if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1227                                 -o conftest.so conftest.o
1228                                 -nostartfiles -nostdlib
1229                                 -Wl,--version-script,conftest.map
1230                        1>&AS_MESSAGE_LOG_FD]);
1231     then
1232       libc_cv_ld_version_script_option=yes
1233     else
1234       libc_cv_ld_version_script_option=no
1235     fi
1236   else
1237     libc_cv_ld_version_script_option=no
1238   fi
1239 else
1240   libc_cv_ld_version_script_option=no
1242 rm -f conftest*])
1243 if test $shared != no &&
1244    test $libc_cv_asm_symver_directive = yes &&
1245    test $libc_cv_ld_version_script_option = yes &&
1246    test $enable_versioning = yes; then
1247   VERSIONING=yes
1248   AC_DEFINE(DO_VERSIONING)
1249 else
1250   VERSIONING=no
1252 AC_SUBST(VERSIONING)
1254 if test $shared != no && test $VERSIONING = no; then
1255   echo "\
1256 *** WARNING: You should not compile GNU libc without versioning. Not using
1257 *** versioning will introduce incompatibilities so that old binaries
1258 *** will not run anymore.
1259 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1261 AC_CACHE_CHECK(for .previous assembler directive,
1262                libc_cv_asm_previous_directive, [dnl
1263 cat > conftest.s <<EOF
1264 .section foo_section
1265 .previous
1267 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1268   libc_cv_asm_previous_directive=yes
1269 else
1270   libc_cv_asm_previous_directive=no
1272 rm -f conftest*])
1273 if test $libc_cv_asm_previous_directive = yes; then
1274   AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1275 else
1276   AC_CACHE_CHECK(for .popsection assembler directive,
1277                  libc_cv_asm_popsection_directive, [dnl
1278   cat > conftest.s <<EOF
1279 .pushsection foo_section
1280 .popsection
1282   if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1283     libc_cv_asm_popsection_directive=yes
1284   else
1285     libc_cv_asm_popsection_directive=no
1286   fi
1287   rm -f conftest*])
1288   if test $libc_cv_asm_popsection_directive = yes; then
1289     AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1290   fi
1292 AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1293                libc_cv_asm_protected_directive, [dnl
1294 cat > conftest.s <<EOF
1295 .protected foo
1296 foo:
1297 .hidden bar
1298 bar:
1300 if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1301   libc_cv_asm_protected_directive=yes
1302 else
1303   AC_MSG_ERROR(assembler support for symbol visibility is required)
1305 rm -f conftest*])
1307 if test $libc_cv_asm_protected_directive = yes; then
1308   AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1309                  libc_cv_visibility_attribute,
1310                  [cat > conftest.c <<EOF
1311                   int foo __attribute__ ((visibility ("hidden"))) = 1;
1312                   int bar __attribute__ ((visibility ("protected"))) = 1;
1314                   libc_cv_visibility_attribute=no
1315                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1316                     if grep '\.hidden.*foo' conftest.s >/dev/null; then
1317                       if grep '\.protected.*bar' conftest.s >/dev/null; then
1318                         libc_cv_visibility_attribute=yes
1319                       fi
1320                     fi
1321                   fi
1322                   rm -f conftest.{c,s}
1323                  ])
1324   if test $libc_cv_visibility_attribute != yes; then
1325     AC_MSG_ERROR(compiler support for visibility attribute is required)
1326   fi
1329 if test $libc_cv_visibility_attribute = yes; then
1330   AC_CACHE_CHECK(for broken __attribute__((visibility())),
1331                  libc_cv_broken_visibility_attribute,
1332                  [cat > conftest.c <<EOF
1333                   int foo (int x);
1334                   int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1335                   int bar (int x) { return x; }
1337                   libc_cv_broken_visibility_attribute=yes
1338                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1339 changequote(,)dnl
1340                     if grep '\.hidden[  _]foo' conftest.s >/dev/null; then
1341 changequote([,])dnl
1342                       libc_cv_broken_visibility_attribute=no
1343                     fi
1344                   fi
1345                   rm -f conftest.c conftest.s
1346                  ])
1347   if test $libc_cv_broken_visibility_attribute = yes; then
1348     AC_MSG_ERROR(working compiler support for visibility attribute is required)
1349   fi
1352 AC_CACHE_CHECK(for broken __attribute__((alias())),
1353                libc_cv_broken_alias_attribute,
1354                [cat > conftest.c <<EOF
1355                extern int foo (int x) __asm ("xyzzy");
1356                int bar (int x) { return x; }
1357                extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1358                extern int dfoo;
1359                extern __typeof (dfoo) dfoo __asm ("abccb");
1360                int dfoo = 1;
1362                libc_cv_broken_alias_attribute=yes
1363                if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1364                  if grep 'xyzzy' conftest.s >/dev/null &&
1365                     grep 'abccb' conftest.s >/dev/null; then
1366                    libc_cv_broken_alias_attribute=no
1367                  fi
1368                fi
1369                rm -f conftest.c conftest.s
1370                ])
1371 if test $libc_cv_broken_alias_attribute = yes; then
1372   AC_MSG_ERROR(working alias attribute support required)
1375 if test $libc_cv_visibility_attribute = yes; then
1376   AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1377                  libc_cv_have_sdata_section,
1378                  [echo "int i;" > conftest.c
1379                   libc_cv_have_sdata_section=no
1380                   if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1381                      | grep '\.sdata' >/dev/null; then
1382                     libc_cv_have_sdata_section=yes
1383                   fi
1384                   rm -f conftest.c conftest.so
1385                  ])
1386   if test $libc_cv_have_sdata_section = yes; then
1387     AC_DEFINE(HAVE_SDATA_SECTION)
1388   fi
1391 AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1392                libc_cv_initfini_array, [dnl
1393 LIBC_TRY_LINK_STATIC([
1394 int foo (void) { return 1; }
1395 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1397   [if $READELF -S conftest | fgrep INIT_ARRAY > /dev/null; then
1398     libc_cv_initfini_array=yes
1399   else
1400     libc_cv_initfini_array=no
1401   fi],
1402   [libc_cv_initfini_array=no])
1404 if test $libc_cv_initfini_array != yes; then
1405   AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1408 AC_CACHE_CHECK(whether to use .ctors/.dtors header and trailer,
1409                libc_cv_ctors_header, [dnl
1410   libc_cv_ctors_header=yes
1411   LIBC_TRY_LINK_STATIC([
1412 __attribute__ ((constructor)) void ctor (void) { asm (""); }
1413 __attribute__ ((destructor))  void dtor (void) { asm (""); }
1415               [dnl
1416       AS_IF([$READELF -WS conftest$ac_exeext | $AWK '
1417         { gsub(/\@<:@ */, "@<:@") }
1418         $2 == ".ctors" || $2 == ".dtors" {
1419           size = strtonum("0x" $6)
1420           align = strtonum("0x" $NF)
1421           seen@<:@$2@:>@ = 1
1422           stub@<:@$2@:>@ = size == align * 2
1423         }
1424         END {
1425           ctors_ok = !seen@<:@".ctors"@:>@ || stub@<:@".ctors"@:>@
1426           dtors_ok = !seen@<:@".dtors"@:>@ || stub@<:@".dtors"@:>@
1427           exit ((ctors_ok && dtors_ok) ? 0 : 1)
1428         }
1429       '], [libc_cv_ctors_header=no])
1430     ], [dnl
1431       AC_MSG_ERROR([missing __attribute__ ((constructor)) support??])
1432     ])
1434 if test $libc_cv_ctors_header = no; then
1435   AC_DEFINE(NO_CTORS_DTORS_SECTIONS)
1438 AC_CACHE_CHECK(for libunwind-support in compiler,
1439                libc_cv_cc_with_libunwind, [
1440   cat > conftest.c <<EOF
1441 int main (void) { return 0; }
1443   if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1444      conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
1445     libc_cv_cc_with_libunwind=yes
1446   else
1447     libc_cv_cc_with_libunwind=no
1448   fi
1449   rm -f conftest*])
1450 AC_SUBST(libc_cv_cc_with_libunwind)
1451 if test $libc_cv_cc_with_libunwind = yes; then
1452   AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1455 LIBC_LINKER_FEATURE([-z nodelete], [-Wl,--enable-new-dtags,-z,nodelete],
1456                     [libc_cv_z_nodelete=yes],
1457                     [AC_MSG_ERROR(linker with -z nodelete support required)])
1459 LIBC_LINKER_FEATURE([-z nodlopen], [-Wl,--enable-new-dtags,-z,nodlopen],
1460                     [libc_cv_z_nodlopen=yes],
1461                     [AC_MSG_ERROR(linker with -z nodlopen support required)])
1463 LIBC_LINKER_FEATURE([-z initfirst], [-Wl,--enable-new-dtags,-z,initfirst],
1464                     [libc_cv_z_initfirst=yes],
1465                     [AC_MSG_ERROR(linker with -z initfirst support required)])
1467 # Add-on fragments can set these for other machines.
1468 libc_commonpagesize=${libc_commonpagesize:-no}
1469 libc_relro_required=${libc_relro_required:-no}
1470 case "$base_machine" in
1471   i[[34567]]86 | x86_64 | powerpc* | s390*)
1472     libc_commonpagesize=0x1000
1473     libc_relro_required=yes
1474     ;;
1475   sparc*)
1476     libc_commonpagesize=0x2000
1477     libc_relro_required=yes
1478     ;;
1479 esac
1481 if test $libc_commonpagesize != no; then
1482   AC_CACHE_CHECK(for -z relro option,
1483                  libc_cv_z_relro, [dnl
1484   libc_cv_z_relro=no
1485   AC_LANG_CONFTEST([AC_LANG_SOURCE([[
1486 int _start (void) { return 42; }
1487 extern void _exit (int);
1488 /* Since these pointers are const, they should go in rodata.
1489    Since they refer to functions that have to be resolved by
1490    dynamic linking, they should instead go in RELRO data.  */
1491 const void *const relro[] = { &_start, &_exit, 0 };
1492 /* GNU ld fails to produce RELRO data when it's very small and there is no
1493    normal writable data following it, or if only uninitialized (.bss) data
1494    follows it, or only very small writable data.  */
1495 int data[0x10000] = { 1, };
1496 ]])])
1497   cat > conftest.awk <<\EOF
1498 BEGIN {
1499   result = "no"
1500   commonpagesize = strtonum(commonpagesize)
1502 { print "LINE:", $0 > "/dev/stderr" }
1503 $1 == "GNU_RELRO" {
1504   vaddr = strtonum($3)
1505   memsz = strtonum($6)
1506   end = vaddr + memsz
1507   printf "vaddr %#x memsz %#x end %#x commonpagesize %#x\n", \
1508     vaddr, memsz, end, commonpagesize > "/dev/stderr"
1509   result = (end % commonpagesize == 0) ? "yes" : "broken"
1511 END { print result }
1513   AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1514                     -fPIC -shared -o conftest.so conftest.c
1515                     -nostartfiles -nostdlib
1516                     -Wl,-z,relro 1>&AS_MESSAGE_LOG_FD]) &&
1517   AC_TRY_COMMAND([$READELF -Wl conftest.so > conftest.ph]) &&
1518   AC_TRY_COMMAND([
1519       $AWK -v commonpagesize=$libc_commonpagesize -f conftest.awk
1520            conftest.ph > conftest.cps
1521     ]) &&
1522   libc_cv_z_relro=`cat conftest.cps 2>&AS_MESSAGE_LOG_FD`
1523   rm -f conftest*])
1524   if { test "x$libc_relro_required" = xyes &&
1525        test "x$libc_cv_z_relro" != xyes
1526      }
1527   then
1528     AC_MSG_ERROR(linker with -z relro support required)
1529   fi
1530 else
1531   AC_MSG_WARN([missing architecture parameter to check for working -z relro])
1534 AC_CACHE_CHECK(for -Bgroup option,
1535                libc_cv_Bgroup, [dnl
1536 cat > conftest.c <<EOF
1537 int _start (void) { return 42; }
1539 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1540                             -fPIC -shared -o conftest.so conftest.c
1541                             -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1542 then
1543   libc_cv_Bgroup=yes
1544 else
1545   libc_cv_Bgroup=no
1547 rm -f conftest*])
1548 AC_SUBST(libc_cv_Bgroup)
1550 ASFLAGS_config=
1551 AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1552                libc_cv_as_noexecstack, [dnl
1553 cat > conftest.c <<EOF
1554 void foo (void) { }
1556 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1557                    -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1558    && grep .note.GNU-stack conftest.s >/dev/null \
1559    && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1560                       -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1561 then
1562   libc_cv_as_noexecstack=yes
1563 else
1564   libc_cv_as_noexecstack=no
1566 rm -f conftest*])
1567 if test $libc_cv_as_noexecstack = yes; then
1568   ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1570 AC_SUBST(ASFLAGS_config)
1572 AC_CACHE_CHECK(for -z combreloc,
1573                libc_cv_z_combreloc, [dnl
1574 cat > conftest.c <<EOF
1575 extern int bar (int);
1576 extern int mumble;
1577 int foo (void) { return bar (mumble); }
1579 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1580                         -fPIC -shared -o conftest.so conftest.c
1581                         -nostdlib -nostartfiles
1582                         -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1583 then
1584 dnl The following test is a bit weak.  We must use a tool which can test
1585 dnl cross-platform since the gcc used can be a cross compiler.  Without
1586 dnl introducing new options this is not easily doable.  Instead use a tool
1587 dnl which always is cross-platform: readelf.  To detect whether -z combreloc
1588 dnl look for a section named .rel.dyn.
1589   if $READELF -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1590     libc_cv_z_combreloc=yes
1591   else
1592     libc_cv_z_combreloc=no
1593   fi
1594 else
1595   libc_cv_z_combreloc=no
1597 rm -f conftest*])
1598 if test "$libc_cv_z_combreloc" = yes; then
1599   AC_DEFINE(HAVE_Z_COMBRELOC)
1601 AC_SUBST(libc_cv_z_combreloc)
1603 LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
1604                     [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
1605 AC_SUBST(libc_cv_z_execstack)
1607 AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1608 LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
1611 AC_SUBST(libc_cv_fpie)
1613 AC_CACHE_CHECK(for --hash-style option,
1614                libc_cv_hashstyle, [dnl
1615 cat > conftest.c <<EOF
1616 int _start (void) { return 42; }
1618 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1619                             -fPIC -shared -o conftest.so conftest.c
1620                             -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1621 then
1622   libc_cv_hashstyle=yes
1623 else
1624   libc_cv_hashstyle=no
1626 rm -f conftest*])
1627 AC_SUBST(libc_cv_hashstyle)
1629 # The linker's default -shared behavior is good enough if it
1630 # does these things that our custom linker scripts ensure that
1631 # all allocated NOTE sections come first.
1632 if test "$use_default_link" = default; then
1633   AC_CACHE_CHECK([for sufficient default -shared layout],
1634                   libc_cv_use_default_link, [dnl
1635   libc_cv_use_default_link=no
1636   cat > conftest.s <<\EOF
1637           .section .note.a,"a",%note
1638           .balign 4
1639           .long 4,4,9
1640           .string "GNU"
1641           .string "foo"
1642           .section .note.b,"a",%note
1643           .balign 4
1644           .long 4,4,9
1645           .string "GNU"
1646           .string "bar"
1648   if AC_TRY_COMMAND([dnl
1649   ${CC-cc} $ASFLAGS -shared -o conftest.so conftest.s 1>&AS_MESSAGE_LOG_FD]) &&
1650        ac_try=`$READELF -S conftest.so | sed -n \
1651          ['${x;p;}
1652           s/^ *\[ *[1-9][0-9]*\]  *\([^ ][^ ]*\)  *\([^ ][^ ]*\) .*$/\2 \1/
1653           t a
1654           b
1655           : a
1656           H']`
1657   then
1658     libc_seen_a=no libc_seen_b=no
1659     set -- $ac_try
1660     while test $# -ge 2 -a "$1" = NOTE; do
1661       case "$2" in
1662       .note.a) libc_seen_a=yes ;;
1663       .note.b) libc_seen_b=yes ;;
1664       esac
1665       shift 2
1666     done
1667     case "$libc_seen_a$libc_seen_b" in
1668     yesyes)
1669       libc_cv_use_default_link=yes
1670       ;;
1671     *)
1672       echo >&AS_MESSAGE_LOG_FD "\
1673 $libc_seen_a$libc_seen_b from:
1674 $ac_try"
1675       ;;
1676     esac
1677   fi
1678   rm -f conftest*])
1679   use_default_link=$libc_cv_use_default_link
1682 AC_CACHE_CHECK(linker output format, libc_cv_output_format, [dnl
1683 if libc_cv_output_format=`
1684 ${CC-cc} -nostartfiles -nostdlib -Wl,--print-output-format 2>&AS_MESSAGE_LOG_FD`
1685 then
1686   :
1687 else
1688   libc_cv_output_format=
1690 test -n "$libc_cv_output_format" || libc_cv_output_format=unknown])
1691 AC_SUBST(libc_cv_output_format)
1693 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1694 cat > conftest.c <<EOF
1695 int foo;
1697 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1698                             conftest.c 1>&AS_MESSAGE_LOG_FD])
1699 then
1700   libc_cv_fno_toplevel_reorder=yes
1701 else
1702   libc_cv_fno_toplevel_reorder=no
1704 rm -f conftest*])
1705 if test $libc_cv_fno_toplevel_reorder = yes; then
1706   fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1707 else
1708   fno_unit_at_a_time=-fno-unit-at-a-time
1710 AC_SUBST(fno_unit_at_a_time)
1712 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1713 LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
1714                    [libc_cv_ssp=yes],
1715                    [libc_cv_ssp=no])
1717 AC_SUBST(libc_cv_ssp)
1719 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1720 cat > conftest.c <<EOF
1721 int foo;
1722 #ifdef __GNUC_GNU_INLINE__
1723 main () { return 0;}
1724 #else
1725 #error
1726 #endif
1728 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1729                             -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1730 then
1731   libc_cv_gnu89_inline=yes
1732 else
1733   libc_cv_gnu89_inline=no
1735 rm -f conftest*])
1736 if test $libc_cv_gnu89_inline = yes; then
1737   gnu89_inline=-fgnu89-inline
1738 else
1739   gnu89_inline=
1741 AC_SUBST(gnu89_inline)
1743 AC_CACHE_CHECK(whether cc puts quotes around section names,
1744                libc_cv_have_section_quotes,
1745                [cat > conftest.c <<EOF
1746                 static const int foo
1747                 __attribute__ ((section ("bar"))) = 1;
1749                 if ${CC-cc} -S conftest.c -o conftest.s; then
1750                   if grep '\.section.*"bar"' conftest.s >/dev/null; then
1751                     libc_cv_have_section_quotes=yes
1752                   else
1753                     libc_cv_have_section_quotes=no
1754                   fi
1755                 else
1756                   libc_cv_have_section_quotes=unknown
1757                 fi
1758                 rm -f conftest.{c,s}
1759                 ])
1760 if test $libc_cv_have_section_quotes = yes; then
1761   AC_DEFINE(HAVE_SECTION_QUOTES)
1764 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1765                [dnl
1766 cat > conftest.s <<EOF
1767 ${libc_cv_dot_text}
1768 .globl foo
1769 foo:
1770 .weak foo
1771 .weak bar; bar = foo
1773 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1774   libc_cv_asm_weak_directive=yes
1775 else
1776   libc_cv_asm_weak_directive=no
1778 rm -f conftest*])
1780 if test $libc_cv_asm_weak_directive = no; then
1781   AC_CACHE_CHECK(for assembler .weakext directive,
1782                  libc_cv_asm_weakext_directive,
1783                  [dnl
1784 cat > conftest.s <<EOF
1785 ${libc_cv_dot_text}
1786 .globl foo
1787 foo:
1788 .weakext bar foo
1789 .weakext baz
1790 .globl baz
1791 baz:
1793   if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1794     libc_cv_asm_weakext_directive=yes
1795   else
1796     libc_cv_asm_weakext_directive=no
1797   fi
1798   rm -f conftest*])
1800 fi # no .weak
1802 if test $libc_cv_asm_weak_directive = yes; then
1803   AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1804 elif test $libc_cv_asm_weakext_directive = yes; then
1805   AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1808 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
1809 case $machine in
1810   sparc/sparc64*) cfi_offset=2047;;
1811   *) cfi_offset=0;;
1812 esac
1813 cat > conftest.s <<EOF
1814         .text
1815         .type   func,%function
1816 func:
1817         .cfi_startproc
1818         .cfi_remember_state
1819         .cfi_rel_offset 1, $cfi_offset
1820         .cfi_endproc
1822 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1823   libc_cv_asm_cfi_directives=yes
1824 else
1825   libc_cv_asm_cfi_directives=no
1827 rm -f conftest*])
1828 if test $libc_cv_asm_cfi_directives = yes; then
1829   AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
1832 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1833 cat > conftest.c <<\EOF
1834 _start () {}
1835 int __eh_pc;
1836 __throw () {}
1838 dnl No \ in command here because it ends up inside ''.
1839 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1840                             -nostdlib -nostartfiles -Wl,--no-whole-archive
1841                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1842   libc_cv_ld_no_whole_archive=yes
1843 else
1844   libc_cv_ld_no_whole_archive=no
1846 rm -f conftest*])
1847 if test $libc_cv_ld_no_whole_archive = no; then
1848   AC_MSG_ERROR([support for --no-whole-archive is needed])
1851 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
1852 cat > conftest.c <<\EOF
1853 _start () {}
1854 int __eh_pc;
1855 __throw () {}
1857 dnl No \ in command here because it ends up inside ''.
1858 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1859                             -nostdlib -nostartfiles -fexceptions
1860                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1861   libc_cv_gcc_exceptions=yes
1862 else
1863   libc_cv_gcc_exceptions=no
1865 rm -f conftest*])
1866 if test $libc_cv_gcc_exceptions = yes; then
1867   exceptions=-fexceptions
1869 AC_SUBST(exceptions)dnl
1871 if test "$host_cpu" = powerpc ; then
1872 # Check for a bug present in at least versions 2.8.x of GCC
1873 # and versions 1.0.x of EGCS.
1874 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
1875 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
1876                libc_cv_c_asmcr0_bug='no',
1877                libc_cv_c_asmcr0_bug='yes')])
1878 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
1879   AC_DEFINE(BROKEN_PPC_ASM_CR0)
1883 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1884 cat > conftest.c <<\EOF
1885 void zero (void *x)
1887   __builtin_memset (x, 0, 1000);
1891 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1892 then
1893   libc_cv_gcc_builtin_memset=no
1894 else
1895   libc_cv_gcc_builtin_memset=yes
1897 rm -f conftest* ])
1898 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1899   AC_DEFINE(HAVE_BUILTIN_MEMSET)
1902 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1903 cat > conftest.c <<\EOF
1904 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1905 char *foo (const char *a, const char *b)
1907   return __builtin_strstr (a, b);
1911 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
1912 then
1913   libc_cv_gcc_builtin_redirection=yes
1914 else
1915   libc_cv_gcc_builtin_redirection=no
1917 rm -f conftest* ])
1918 if test "$libc_cv_gcc_builtin_redirection" = no; then
1919   AC_MSG_ERROR([support for the symbol redirection needed])
1922 dnl Check whether the compiler supports the __thread keyword.
1923 AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
1924 [cat > conftest.c <<\EOF
1925 __thread int a = 42;
1927 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
1928   libc_cv_gcc___thread=yes
1929 else
1930   libc_cv_gcc___thread=no
1932 rm -f conftest*])
1933 if test "$libc_cv_gcc___thread" = no; then
1934   AC_MSG_ERROR([support for the __thread keyword is required])
1937 dnl Check whether the compiler supports the tls_model attribute.
1938 AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
1939 cat > conftest.c <<\EOF
1940 extern __thread int a __attribute__((tls_model ("initial-exec")));
1942 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
1943   libc_cv_gcc_tls_model_attr=yes
1944 else
1945   libc_cv_gcc_tls_model_attr=no
1947 rm -f conftest*])
1948 if test "$libc_cv_gcc_tls_model_attr" = no; then
1949   AC_MSG_ERROR([support for the tls_model attribute is required])
1952 dnl Determine how to disable generation of FMA instructions.
1953 AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
1954                libc_cv_cc_nofma, [dnl
1955 libc_cv_cc_nofma=
1956 for opt in -ffp-contract=off -mno-fused-madd; do
1957   LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
1958 done])
1959 AC_SUBST(libc_cv_cc_nofma)
1961 if test -n "$submachine"; then
1962   AC_CACHE_CHECK([for compiler option for CPU variant],
1963                  libc_cv_cc_submachine, [dnl
1964   libc_cv_cc_submachine=no
1965   for opt in "-march=$submachine" "-mcpu=$submachine"; do
1966     LIBC_TRY_CC_OPTION([$opt], [
1967       libc_cv_cc_submachine="$opt"
1968       break], [])
1969   done])
1970   if test "x$libc_cv_cc_submachine" = xno; then
1971     AC_MSG_ERROR([${CC-cc} does not support $submachine])
1972   fi
1974 AC_SUBST(libc_cv_cc_submachine)
1976 AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
1977 __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
1978 cat > conftest.c <<EOF
1979 void
1980 __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
1981 foo (void) {}
1983 libc_cv_cc_loop_to_function=no
1984 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
1985 then
1986   libc_cv_cc_loop_to_function=yes
1988 rm -f conftest*])
1989 if test $libc_cv_cc_loop_to_function = yes; then
1990   AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
1992 AC_SUBST(libc_cv_cc_loop_to_function)
1994 dnl Check whether we have the gd library available.
1995 AC_MSG_CHECKING(for libgd)
1996 if test "$with_gd" != "no"; then
1997   old_CFLAGS="$CFLAGS"
1998   CFLAGS="$CFLAGS $libgd_include"
1999   old_LDFLAGS="$LDFLAGS"
2000   LDFLAGS="$LDFLAGS $libgd_ldflags"
2001   old_LIBS="$LIBS"
2002   LIBS="$LIBS -lgd -lpng -lz -lm"
2003   AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2004   CFLAGS="$old_CFLAGS"
2005   LDFLAGS="$old_LDFLAGS"
2006   LIBS="$old_LIBS"
2007 else
2008   LIBGD=no
2010 AC_MSG_RESULT($LIBGD)
2011 AC_SUBST(LIBGD)
2013 # SELinux detection
2014 if test x$with_selinux = xno ; then
2015   have_selinux=no;
2016 else
2017   # See if we have the SELinux library
2018   AC_CHECK_LIB(selinux, is_selinux_enabled,
2019                have_selinux=yes, have_selinux=no)
2020   # See if we have the SELinux header with the NSCD permissions in it.
2021   if test x$have_selinux = xyes ; then
2022     AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2023     AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2024                     [#ifdef NSCD__SHMEMHOST
2025                      return 0;
2026                      #else
2027                      #error NSCD__SHMEMHOST not defined
2028                      #endif],
2029                     have_selinux=yes, have_selinux=no)
2030     AC_MSG_RESULT($have_selinux)
2031   fi
2033   if test x$with_selinux = xyes ; then
2034     if test x$have_selinux = xno ; then
2035       AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2036     fi
2037   fi
2039 # Check if we're building with SELinux support.
2040 if test "x$have_selinux" = xyes; then
2041   AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2043   # See if we have the libaudit library
2044   AC_CHECK_LIB(audit, audit_log_user_avc_message,
2045                have_libaudit=yes, have_libaudit=no)
2046   if test "x$have_libaudit" = xyes; then
2047     AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2048   fi
2049   AC_SUBST(have_libaudit)
2051   # See if we have the libcap library
2052   AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2053   if test "x$have_libcap" = xyes; then
2054     AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2055   fi
2056   AC_SUBST(have_libcap)
2058 AC_SUBST(have_selinux)
2060 dnl check for the size of 'long double'.
2061 AC_CHECK_SIZEOF(long double, 0)
2062 sizeof_long_double=$ac_cv_sizeof_long_double
2063 AC_SUBST(sizeof_long_double)
2065 CPPUNDEFS=
2066 dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
2067 dnl Since we are building the implementations of the fortified functions here,
2068 dnl having the macro defined interacts very badly.
2069 AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
2070 [AC_TRY_COMPILE([], [
2071 #ifdef _FORTIFY_SOURCE
2072 # error bogon
2073 #endif],
2074                 [libc_cv_predef_fortify_source=no],
2075                 [libc_cv_predef_fortify_source=yes])])
2076 if test $libc_cv_predef_fortify_source = yes; then
2077   CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
2079 AC_SUBST(CPPUNDEFS)
2081 dnl Check for silly hacked compilers inserting -fstack-protector.
2082 dnl This breaks badly for the early startup code we compile, since
2083 dnl the compiled code can refer to a magic machine-dependent location
2084 dnl for the canary value before we have sufficient setup for that to
2085 dnl work.  It's also questionable to build all of libc with this flag
2086 dnl even when you're doing that for most applications you build, since
2087 dnl libc's code is so heavily-used and performance-sensitive.  If we
2088 dnl ever really want to make that work, it should be enabled explicitly
2089 dnl in the libc build, not inherited from implicit compiler settings.
2090 AC_CACHE_CHECK([whether $CC implicitly enables -fstack-protector],
2091                libc_cv_predef_stack_protector, [
2092 AC_TRY_COMPILE([extern void foobar (char *);],
2093                [char large_array[2048]; foobar (large_array);], [
2094 libc_undefs=`$NM -u conftest.o |
2095   LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
2096     2>&AS_MESSAGE_LOG_FD` || {
2097   AC_MSG_ERROR([confusing output from $NM -u])
2099 echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
2100 # On some architectures, there are architecture-specific undefined
2101 # symbols (resolved by the linker), so filter out unknown symbols.
2102 # This will fail to produce the correct result if the compiler
2103 # defaults to -fstack-protector but this produces an undefined symbol
2104 # other than __stack_chk_fail.  However, compilers like that have not
2105 # been encountered in practice.
2106 libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
2107 case "$libc_undefs" in
2108 foobar) libc_cv_predef_stack_protector=no ;;
2109 '__stack_chk_fail
2110 foobar') libc_cv_predef_stack_protector=yes ;;
2111 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
2112 esac],
2113                [AC_MSG_ERROR([test compilation failed])])
2115 libc_extra_cflags=
2116 if test $libc_cv_predef_stack_protector = yes; then
2117   libc_extra_cflags=-fno-stack-protector
2119 AC_SUBST(libc_extra_cflags)
2121 ### End of automated tests.
2122 ### Now run sysdeps configure fragments.
2124 # They also can set these variables.
2125 use_ldconfig=no
2126 ldd_rewrite_script=no
2127 libc_cv_sysconfdir=$sysconfdir
2128 libc_cv_localstatedir=$localstatedir
2129 libc_cv_gcc_unwind_find_fde=no
2130 libc_cv_idn=no
2132 # Iterate over all the sysdep directories we will use, running their
2133 # configure fragments.
2134 for dir in $sysnames; do
2135   case $dir in
2136     /*) dest=$dir ;;
2137     *)  dest=$srcdir/$dir ;;
2138   esac
2139   if test -r $dest/configure; then
2140     AC_MSG_RESULT(running configure fragment for $dir)
2141     . $dest/configure
2142   fi
2143 done
2145 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2146   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2148 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2150 # A sysdeps configure fragment can reset this if IFUNC is not actually
2151 # usable even though the assembler knows how to generate the symbol type.
2152 if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
2153   AC_DEFINE(HAVE_IFUNC)
2156 # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
2157 # configure fragment can override the value to prevent this AC_DEFINE.
2158 AC_SUBST(use_nscd)
2159 if test "x$use_nscd" != xno; then
2160   AC_DEFINE([USE_NSCD])
2162 if test "x$build_nscd" = xdefault; then
2163   build_nscd=$use_nscd
2166 # Test for old glibc 2.0.x headers so that they can be removed properly
2167 # Search only in includedir.
2168 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2169 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2170 then
2171   old_glibc_headers=yes
2172 else
2173   old_glibc_headers=no
2175 AC_MSG_RESULT($old_glibc_headers)
2176 if test ${old_glibc_headers} = yes; then
2177   AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2178   AC_MSG_WARN(*** be removed.)
2180 AC_SUBST(old_glibc_headers)
2182 AC_SUBST(libc_cv_slibdir)
2183 AC_SUBST(libc_cv_rtlddir)
2184 AC_SUBST(libc_cv_localedir)
2185 AC_SUBST(libc_cv_sysconfdir)
2186 AC_SUBST(libc_cv_localstatedir)
2187 AC_SUBST(libc_cv_rootsbindir)
2188 AC_SUBST(libc_cv_forced_unwind)
2190 if test x$use_ldconfig = xyes; then
2191   AC_DEFINE(USE_LDCONFIG)
2193 AC_SUBST(use_ldconfig)
2194 AC_SUBST(ldd_rewrite_script)
2196 AC_SUBST(static)
2197 AC_SUBST(shared)
2199 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2200 [libc_cv_pic_default=yes
2201 cat > conftest.c <<EOF
2202 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2203 # error PIC is default.
2204 #endif
2206 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2207   libc_cv_pic_default=no
2209 rm -f conftest.*])
2210 AC_SUBST(libc_cv_pic_default)
2212 AC_SUBST(profile)
2213 AC_SUBST(static_nss)
2215 AC_SUBST(DEFINES)
2217 dnl See sysdeps/mach/configure.in for this variable.
2218 AC_SUBST(mach_interface_list)
2220 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2221 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2222 AC_SUBST(VERSION)
2223 AC_SUBST(RELEASE)
2225 AC_CONFIG_FILES([config.make Makefile])
2226 AC_CONFIG_COMMANDS([default],[[
2227 case $CONFIG_FILES in *config.make*)
2228 echo "$config_vars" >> config.make;;
2229 esac
2230 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
2231 AC_OUTPUT