Add AVX support to ld.so auditing for x86-64.
[glibc.git] / configure.in
blob4584afe6053b00074f5a94b84655b50c3bb14351
1 dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION([$CVSid$])
3 AC_PREREQ(2.53)dnl              dnl Minimum Autoconf version required.
4 AC_INIT([GNU C Library], [(see version.h)], [glibc])
5 AC_CONFIG_SRCDIR([include/features.h])
6 AC_CONFIG_HEADERS([config.h])
7 AC_CONFIG_AUX_DIR([scripts])
9 AC_CANONICAL_HOST
11 AC_PROG_CC
12 if test $host != $build; then
13   AC_CHECK_PROGS(BUILD_CC, gcc cc)
15 AC_SUBST(cross_compiling)
16 AC_PROG_CPP
17 # We need the C++ compiler only for testing.
18 AC_PROG_CXX
20 if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then
21   AC_MSG_ERROR([you must configure in a separate build directory])
24 # This will get text that should go into config.make.
25 config_vars=
27 # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
28 AC_ARG_WITH([gd],
29             AC_HELP_STRING([--with-gd=DIR],
30                            [find libgd include dir and library with prefix DIR]),
31             [dnl
32 case "$with_gd" in
33 yes|''|no) ;;
34 *) libgd_include="-I$withval/include"
35    libgd_ldflags="-L$withval/lib" ;;
36 esac
38 AC_ARG_WITH([gd-include],
39             AC_HELP_STRING([--with-gd-include=DIR],
40                            [find libgd include files in DIR]),
41             [dnl
42 case "$with_gd_include" in
43 ''|no) ;;
44 *) libgd_include="-I$withval" ;;
45 esac
47 AC_ARG_WITH([gd-lib],
48             AC_HELP_STRING([--with-gd-lib=DIR],
49                            [find libgd library files in DIR]),
50             [dnl
51 case "$with_gd_lib" in
52 ''|no) ;;
53 *) libgd_ldflags="-L$withval" ;;
54 esac
57 if test -n "$libgd_include"; then
58   config_vars="$config_vars
59 CFLAGS-memusagestat.c = $libgd_include"
61 if test -n "$libgd_ldflags"; then
62   config_vars="$config_vars
63 libgd-LDFLAGS = $libgd_ldflags"
66 dnl Arguments to specify presence of other packages/features.
67 AC_ARG_WITH([fp],
68             AC_HELP_STRING([--with-fp],
69                            [if using floating-point hardware @<:@default=yes@:>@]),
70             [with_fp=$withval],
71             [with_fp=yes])
72 AC_SUBST(with_fp)
73 AC_ARG_WITH([binutils],
74             AC_HELP_STRING([--with-binutils=PATH],
75                            [specify location of binutils (as and ld)]),
76             [path_binutils=$withval],
77             [path_binutils=''])
78 AC_ARG_WITH([elf],
79             AC_HELP_STRING([--with-elf],
80                            [if using the ELF object format]),
81             [elf=$withval],
82             [elf=no])
83 AC_ARG_WITH([selinux],
84             AC_HELP_STRING([--with-selinux],
85                            [if building with SELinux support]),
86             [with_selinux=$withval],
87             [with_selinux=auto])
88 AC_ARG_WITH([xcoff],
89             AC_HELP_STRING([--with-xcoff],
90                            [if using the XCOFF object format]),
91             [xcoff=$withval],
92             [xcoff=no])
93 AC_ARG_WITH([cvs],
94             AC_HELP_STRING([--without-cvs],
95                            [if CVS should not be used]),
96             [with_cvs=$withval],
97             [with_cvs=yes])
98 if test "$with_cvs" = yes; then
99   if test -d $srcdir/CVS && grep :pserver: $srcdir/CVS/Root > /dev/null
100   then
101     with_cvs=no
102   fi
104 AC_SUBST(with_cvs)
106 AC_ARG_WITH([headers],
107             AC_HELP_STRING([--with-headers=PATH],
108                            [location of system headers to use
109                             (for example /usr/src/linux/include)
110                             @<:@default=compiler default@:>@]),
111             [sysheaders=$withval],
112             [sysheaders=''])
114 AC_ARG_ENABLE([sanity-checks],
115               AC_HELP_STRING([--disable-sanity-checks],
116                              [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
117               [enable_sanity=$enableval],
118               [enable_sanity=yes])
120 AC_SUBST(enable_check_abi)
121 AC_ARG_ENABLE([check-abi],
122               AC_HELP_STRING([--enable-check-abi],
123                              [do "make check-abi" in "make check" (no/warn/yes)
124                               @<:@default=no@:>@]),
125               [enable_check_abi=$enableval],
126               [enable_check_abi=no])
128 dnl Arguments to enable or disable building the static, shared, profiled,
129 dnl and -fomit-frame-pointer libraries.
130 dnl I've disabled this for now since we cannot build glibc without static
131 dnl libraries built in the moment.
132 dnl AC_ARG_ENABLE([static],
133 dnl               AC_HELP_STRING([--enable-static],
134 dnl                              [build static library @<:@default=yes@:>@]),
135 dnl               [static=$enableval],
136 dnl               [static=yes])
137 static=yes
138 AC_ARG_ENABLE([shared],
139               AC_HELP_STRING([--enable-shared],
140                              [build shared library @<:@default=yes if GNU ld & ELF@:>@]),
141               [shared=$enableval],
142               [shared=default])
143 AC_ARG_ENABLE([profile],
144               AC_HELP_STRING([--enable-profile],
145                              [build profiled library @<:@default=no@:>@]),
146               [profile=$enableval],
147               [profile=no])
148 AC_ARG_ENABLE([omitfp],
149               AC_HELP_STRING([--enable-omitfp],
150                              [build undebuggable optimized library @<:@default=no@:>@]),
151               [omitfp=$enableval],
152               [omitfp=no])
153 AC_ARG_ENABLE([bounded],
154               AC_HELP_STRING([--enable-bounded],
155                              [build with runtime bounds checking @<:@default=no@:>@]),
156               [bounded=$enableval],
157               [bounded=no])
158 AC_ARG_ENABLE([versioning],
159               AC_HELP_STRING([--disable-versioning],
160                              [do not include versioning information in the library objects @<:@default=yes if supported@:>@]),
161               [enable_versioning=$enableval],
162               [enable_versioning=yes])
164 AC_ARG_ENABLE([oldest-abi],
165               AC_HELP_STRING([--enable-oldest-abi=ABI],
166                              [configure the oldest ABI supported @<:@e.g. 2.2@:>@ @<:@default=glibc default@:>@]),
167               [oldest_abi=$enableval],
168               [oldest_abi=no])
169 if test "$oldest_abi" = yes || test "$oldest_abi" = no; then
170   oldest_abi=default
171 else
172   AC_DEFINE_UNQUOTED(GLIBC_OLDEST_ABI, "$oldest_abi")
174 AC_SUBST(oldest_abi)
176 AC_ARG_ENABLE([stackguard-randomization],
177               AC_HELP_STRING([--enable-stackguard-randomization],
178                              [initialize __stack_chk_guard canary with a random number at program start]),
179               [enable_stackguard_randomize=$enableval],
180               [enable_stackguard_randomize=no])
181 if test "$enable_stackguard_randomize" = yes; then
182   AC_DEFINE(ENABLE_STACKGUARD_RANDOMIZE)
185 dnl Generic infrastructure for drop-in additions to libc.
186 AC_ARG_ENABLE([add-ons],
187               AC_HELP_STRING([--enable-add-ons@<:@=DIRS...@:>@],
188                              [configure and build add-ons in DIR1,DIR2,...
189                               search for add-ons if no parameter given]),
190                              , [enable_add_ons=yes])
192 dnl Let the user avoid using TLS.  Don't know why but...
193 AC_ARG_WITH([tls],
194             AC_HELP_STRING([--with-tls],
195                            [enable support for TLS]),
196             [usetls=$withval],
197             [usetls=yes])
199 AC_ARG_WITH([__thread],
200             AC_HELP_STRING([--without-__thread],
201                            [do not use TLS features even when supporting them]),
202             [use__thread=$withval],
203             [use__thread=yes])
205 AC_ARG_ENABLE([hidden-plt],
206               AC_HELP_STRING([--disable-hidden-plt],
207                              [do not hide internal function calls to avoid PLT]),
208               [hidden=$enableval],
209               [hidden=yes])
210 if test "x$hidden" = xno; then
211   AC_DEFINE(NO_HIDDEN)
214 AC_ARG_ENABLE([bind-now],
215               AC_HELP_STRING([--enable-bind-now],
216                              [disable lazy relocations in DSOs]),
217               [bindnow=$enableval],
218               [bindnow=no])
219 AC_SUBST(bindnow)
221 dnl On some platforms we cannot use dynamic loading.  We must provide
222 dnl static NSS modules.
223 AC_ARG_ENABLE([static-nss],
224               AC_HELP_STRING([--enable-static-nss],
225                              [build static NSS modules @<:@default=no@:>@]),
226               [static_nss=$enableval],
227               [static_nss=no])
228 dnl Enable static NSS also if we build no shared objects.
229 if test x"$static_nss" = xyes || test x"$shared" = xno; then
230   static_nss=yes
231   AC_DEFINE(DO_STATIC_NSS)
234 AC_ARG_ENABLE([force-install],
235               AC_HELP_STRING([--disable-force-install],
236                              [don't force installation of files from this package, even if they are older than the installed files]),
237               [force_install=$enableval],
238               [force_install=yes])
239 AC_SUBST(force_install)
241 dnl On some platforms we allow dropping compatibility with all kernel
242 dnl versions.
243 AC_ARG_ENABLE([kernel],
244               AC_HELP_STRING([--enable-kernel=VERSION],
245                              [compile for compatibility with kernel not older than VERSION]),
246               [minimum_kernel=$enableval],
247               [])
248 dnl Prevent unreasonable values.
249 if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
250   # Better nothing than this.
251   minimum_kernel=""
252 else
253   if test "$minimum_kernel" = current; then
254     minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
255   fi
258 dnl For the development we sometimes want gcc to issue even more warnings.
259 dnl This is not the default since many of the extra warnings are not
260 dnl appropriate.
261 AC_ARG_ENABLE([all-warnings],
262               AC_HELP_STRING([--enable-all-warnings],
263                              [enable all useful warnings gcc can issue]),
264               [all_warnings=$enableval],
265               [])
266 AC_SUBST(all_warnings)
268 AC_ARG_ENABLE([multi-arch],
269               AC_HELP_STRING([--enable-multi-arch],
270                              [enable single DSO with optimizations for multiple architectures]),
271               [multi_arch=$enableval],
272               [multi_arch=no])
273 if test x"$multi_arch" = xyes; then
274   AC_DEFINE(USE_MULTIARCH)
275   multi_arch_d=/multiarch
277 AC_SUBST(multi_arch)
279 AC_ARG_ENABLE([experimental-malloc],
280               AC_HELP_STRING([--enable-experimental-malloc],
281                              [enable experimental malloc features]),
282               [experimental_malloc=$enableval],
283               [])
284 AC_SUBST(experimental_malloc)
286 AC_ARG_ENABLE([nss-crypt],
287               AC_HELP_STRING([--enable-nss-crypt],
288                              [enable libcrypt to use nss]),
289               [nss_crypt=$enableval],
290               [nss_crypt=no])
291 if test x$nss_crypt = xyes; then
292   nss_includes=-I$(nss-config --includedir 2>/dev/null)
293   if test $? -ne 0; then
294     AC_MSG_ERROR([cannot find include directory with nss-config])
295   fi
296   old_CFLAGS="$CFLAGS"
297   CFLAGS="$CFLAGS $nss_includes"
298   AC_COMPILE_IFELSE([typedef int PRBool;
299 #include <hasht.h>
300 #include <nsslowhash.h>
301 void f (void) { NSSLOW_Init (); }],
302              libc_cv_nss_crypt=yes,
303              AC_MSG_ERROR([
304 cannot find NSS headers with lowlevel hash function interfaces]))
305   old_LIBS="$LIBS"
306   LIBS="$LIBS -lfreebl3"
307   AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
308 #include <hasht.h>
309 #include <nsslowhash.h>],
310                                   [NSSLOW_Init();])],
311                  libc_cv_nss_crypt=yes,
312                  AC_MSG_ERROR([
313 cannot link program using lowlevel NSS hash functions]))
314   CFLAGS="$old_CFLAGS"
315   LIBS="$old_LIBS"
316 else
317   libc_cv_nss_crypt=no
319 AC_SUBST(libc_cv_nss_crypt)
321 # The way shlib-versions is used to generate soversions.mk uses a
322 # fairly simplistic model for name recognition that can't distinguish
323 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
324 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
325 # tell.  This doesn't get used much beyond that, so it's fairly safe.
326 case "$host_os" in
327 linux*)
328   ;;
329 gnu*)
330   host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
331   ;;
332 esac
334 # We keep the original values in `$config_*' and never modify them, so we
335 # can write them unchanged into config.make.  Everything else uses
336 # $machine, $vendor, and $os, and changes them whenever convenient.
337 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
339 # Don't allow vendor == "unknown"
340 test "$config_vendor" = unknown && config_vendor=
341 config_os="`echo $config_os | sed 's/^unknown-//'`"
343 # Some configurations imply other options.
344 case "$host_os" in
345 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
346 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
347   ;;
348 gnu* | linux* | freebsd* | netbsd* | sysv4* | solaris2* | irix6*)
349   # These systems (almost) always use the ELF format.
350   elf=yes
351   ;;
352 aix*)
353   # These systems are always xcoff
354   xcoff=yes
355   elf=no
356   ;;
357 esac
359 # The configure fragment of an add-on port can modify these to supplement
360 # or override the table in the case statement below.  No fragment should
361 # ever change the config_* variables, however.
362 machine=$config_machine
363 vendor=$config_vendor
364 os=$config_os
365 base_os=''
367 # config.guess on some IBM machines says `rs6000' instead of `powerpc'.
368 # Unify this here.
369 if test "$machine" = rs6000; then
370   machine="powerpc"
373 # Braindead PowerPC box with absolutely no FPU.
374 case "$machine-$host_os" in
375   powerpc*-*soft)
376     with_fp=no
377     ;;
378 esac
380 submachine=
381 AC_ARG_WITH([cpu],
382             AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
383             [dnl
384   case "$withval" in
385   yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
386   no) ;;
387   *) submachine="$withval" ;;
388   esac
391 # An add-on can set this when it wants to disable the sanity check below.
392 libc_config_ok=no
394 dnl Having this here, though empty, makes sure that if add-ons' fragments
395 dnl do AC_CONFIG_SUBDIRS([some-dir]), which just sets $subdirs, then
396 dnl our AC_OUTPUT will actually use it.
397 AC_CONFIG_SUBDIRS()
399 case "$enable_add_ons" in
400 ''|no) add_ons= ;;
401 yes|'*')
402  add_ons=`cd $srcdir && ls -d 2> /dev/null */configure */sysdeps |
403           sed 's@/[[^/]]*$@@' | sort | uniq`
404          add_ons_automatic=yes
405          ;;
406 *) add_ons=`echo "$enable_add_ons" | sed 's/,/ /g'`
407        add_ons_automatic=no ;;
408 esac
410 configured_add_ons=
411 add_ons_sfx=
412 add_ons_pfx=
413 if test x"$add_ons" != x; then
414   for f in $add_ons; do
415     # Some sanity checks
416     case "$f" in
417     crypt)
418       AC_MSG_ERROR([
419 *** It seems that you're using an old \`crypt' add-on.  crypt is now
420 *** part of glibc and using the old add-on will not work with this
421 *** release.  Start again with fresh sources and without the old
422 *** \`crypt' add-on.])
423     ;;
424     localedata)
425       AC_MSG_ERROR([
426 *** It seems that you're using an old \`localedata' add-on.  localedata
427 *** is now part of glibc and using the old add-on will not work with
428 *** this release.  Start again with fresh sources and without the old
429 *** \`localedata' add-on.])
430     ;;
431     esac
432   done
434   # Now source each add-on's configure fragment.
435   # The fragments can use $srcdir/$libc_add_on to find themselves,
436   # and test $add_ons_automatic to see if they were explicitly requested.
437   # A fragment can clear (or even change) $libc_add_on to affect
438   # whether it goes into the list to be actually used in the build.
439   use_add_ons=
440   for libc_add_on in $add_ons; do
441     # Test whether such a directory really exists.
442     # It can be absolute, or relative to $srcdir, or relative to the build dir.
443     case "$libc_add_on" in
444     /*)
445       libc_add_on_srcdir=$libc_add_on
446       ;;
447     *)
448       test -d "$srcdir/$libc_add_on" || {
449         if test -d "$libc_add_on"; then
450           libc_add_on="`pwd`/$libc_add_on"
451         else
452           AC_MSG_ERROR(add-on directory \"$libc_add_on\" does not exist)
453         fi
454       }
455       libc_add_on_srcdir=$srcdir/$libc_add_on
456       ;;
457     esac
459     libc_add_on_frag=$libc_add_on_srcdir/configure
460     libc_add_on_canonical=
461     if test -r "$libc_add_on_frag"; then
462       AC_MSG_NOTICE(running configure fragment for add-on $libc_add_on)
463       libc_add_on_canonical=unknown
464       libc_add_on_subdirs=
465       . "$libc_add_on_frag"
466       test -z "$libc_add_on" || {
467         configured_add_ons="$configured_add_ons $libc_add_on"
468         if test "x$libc_add_on_canonical" = xunknown; then
469           AC_MSG_ERROR(fragment must set \$libc_add_on_canonical)
470         fi
471         for d in $libc_add_on_subdirs; do
472           case "$libc_add_on" in
473           /*) subdir_srcdir="$libc_add_on" ;;
474           *) subdir_srcdir="\$(..)$libc_add_on" ;;
475           esac
476           case "$d" in
477           .)
478             d="${libc_add_on_canonical:-$libc_add_on}"
479             ;;
480           /*)
481             subdir_srcdir="$d"
482             ;;
483           *)
484             subdir_srcdir="$subdir_srcdir/$d"
485             ;;
486           esac
487           d=`echo "$d" | sed 's@/*$@@;s@^.*/@@'`
488           add_on_subdirs="$add_on_subdirs $d"
489           test "$subdir_srcdir" = "\$(..)$d" || config_vars="$config_vars
490 $d-srcdir = $subdir_srcdir"
491         done
492       }
493     fi
494     if test -n "$libc_add_on"; then
495       if frags=`ls -d $libc_add_on_srcdir/sysdeps/*/preconfigure 2> /dev/null`
496       then
497         AC_MSG_CHECKING(add-on $libc_add_on for preconfigure fragments)
498         for frag in $frags; do
499           name=`echo "$frag" | sed 's@/[[^/]]*$@@;s@^.*/@@'`
500           echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
501           . "$frag"
502         done
503         AC_MSG_RESULT()
504       fi
505       use_add_ons="$use_add_ons $libc_add_on"
506       add_ons_pfx="$add_ons_pfx $libc_add_on/"
507       test -z "$libc_add_on_canonical" ||
508       add_ons_sfx="$add_ons_sfx /$libc_add_on_canonical"
509     fi
510   done
511   # Use echo to strip excess whitespace.
512   add_ons="`echo $use_add_ons`"
514 AC_SUBST(add_ons)
515 AC_SUBST(add_on_subdirs)
519 ### I put this here to prevent those annoying emails from people who cannot
520 ### read and try to compile glibc on unsupported platforms.  --drepper
522 ### By using the undocumented --enable-hacker-mode option for configure
523 ### one can skip this test to make the configuration not fail for unsupported
524 ### platforms.
526 if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
527   case "$machine-$host_os" in
528   *-linux* | *-gnu* | arm*-none* | powerpc-aix4.3.*)
529     ;;
530   *)
531     echo "*** The GNU C library is currently not available for this platform."
532     echo "*** So far nobody cared to port it and if there is no volunteer it"
533     echo "*** might never happen.  So, if you have interest to see glibc on"
534     echo "*** this platform visit"
535     echo "***   http://www.gnu.org/software/libc/porting.html"
536     echo "*** and join the group of porters"
537     exit 1
538     ;;
539   esac
542 dnl We need to use [ and ] for other purposes for a while now.
543 changequote(,)dnl
544 # Expand the configuration machine name into a subdirectory by architecture
545 # type and particular chip.  If an add-on configure fragment already set
546 # base_machine, we don't change it.
547 test -n "$base_machine" || case "$machine" in
548 a29k | am29000) base_machine=a29k machine=a29k ;;
549 c3[012])        base_machine=cx0 machine=cx0/c30 ;;
550 c4[04])         base_machine=cx0 machine=cx0/c40 ;;
551 i[34567]86)     base_machine=i386 machine=i386/$machine ;;
552 ia64)           base_machine=ia64 machine=ia64 ;;
553 m88???)         base_machine=m88k machine=m88k/$machine ;;
554 m88k)           base_machine=m88k machine=m88k/m88100 ;;
555 powerpc)        base_machine=powerpc machine=powerpc/powerpc32 ;;
556 powerpc64)      base_machine=powerpc machine=powerpc/powerpc64 ;;
557 s390)           base_machine=s390 machine=s390/s390-32 ;;
558 s390x)          base_machine=s390 machine=s390/s390-64 ;;
559 sh3*)           base_machine=sh machine=sh/sh3 ;;
560 sh4*)           base_machine=sh machine=sh/sh4 ;;
561 sparc | sparcv[67])
562                 base_machine=sparc machine=sparc/sparc32 ;;
563 sparcv8 | supersparc | hypersparc)
564                 base_machine=sparc machine=sparc/sparc32/sparcv8 ;;
565 sparcv8plus | sparcv8plusa | sparcv9)
566                 base_machine=sparc machine=sparc/sparc32/sparcv9 ;;
567 sparcv8plusb | sparcv9b)
568                 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9b ;;
569 sparcv9v)
570                 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v ;;
571 sparcv9v2)
572                 base_machine=sparc machine=sparc/sparc32/sparcv9/sparcv9v2 ;;
573 sparc64)
574                 base_machine=sparc machine=sparc/sparc64 ;;
575 sparc64b)
576                 base_machine=sparc machine=sparc/sparc64/sparcv9b ;;
577 sparc64v)
578                 base_machine=sparc machine=sparc/sparc64/sparcv9v ;;
579 sparc64v2)
580                 base_machine=sparc machine=sparc/sparc64/sparcv9v2 ;;
581 *)              base_machine=$machine ;;
582 esac
583 changequote([,])dnl
584 AC_SUBST(base_machine)
586 if test "$base_machine" = "i386"; then
587   AC_DEFINE(USE_REGPARMS)
590 # Compute the list of sysdep directories for this configuration.
591 # This can take a while to compute.
592 sysdep_dir=$srcdir/sysdeps
593 AC_MSG_CHECKING(sysdep dirs)
594 dnl We need to use [ and ] for other purposes for a while now.
595 changequote(,)dnl
596 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
597 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
599 test "x$base_os" != x || case "$os" in
600 gnu*)
601   base_os=mach/hurd ;;
602 netbsd* | 386bsd* | freebsd* | bsdi*)
603   base_os=unix/bsd/bsd4.4 ;;
604 osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
605   base_os=unix/bsd ;;
606 sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
607   base_os=unix/sysv ;;
608 irix6*)
609   base_os=unix/sysv/irix6/$os ;;
610 solaris[2-9]*)
611   base_os=unix/sysv/sysv4 ;;
612 hpux*)
613   base_os=unix/sysv/hpux/$os ;;
614 aix4.3*)
615   base_os=unix/sysv/aix/aix4.3 ;;
616 none)
617   base_os=standalone ;;
618 esac
620 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
621 tail=$os
622 ostry=$os
623 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
624   ostry="$ostry /$o"
625   tail=$o
626 done
627 o=`echo $tail | sed 's/[0-9]*$//'`
628 if test $o != $tail; then
629   ostry="$ostry /$o"
631 # For linux-gnu, try linux-gnu, then linux.
632 o=`echo $tail | sed 's/-.*$//'`
633 if test $o != $tail; then
634   ostry="$ostry /$o"
637 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
638 base=
639 tail=$base_os
640 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
641   set $b
642   base="$base /$1"
643   tail="$2"
644 done
646 # For sparc/sparc32, try sparc/sparc32 and then sparc.
647 mach=
648 tail=$machine${submachine:+/$submachine}
649 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
650   set $m
651   # Prepend the machine's FPU directory unless --without-fp.
652   if test "$with_fp" = yes; then
653     mach="$mach /$1/fpu"
654   else
655     mach="$mach /$1/nofpu"
656   fi
657   mach="$mach /$1"
658   tail="$2"
659 done
661 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
662 changequote([,])dnl
664 # Find what sysdep directories exist.
665 sysnames_add_ons=
666 sysnames=
667 for b in $base ''; do
668   for m0 in $mach ''; do
669     for v in /$vendor ''; do
670       test "$v" = / && continue
671       for o in /$ostry ''; do
672         test "$o" = / && continue
673         for m in $multi_arch_d $mach ''; do
674           for d in $add_ons_pfx ''; do
675             for a in $add_ons_sfx ''; do
676               if test -n "$m0$m0sub$b$v$o$m$msub"; then
677                 try_srcdir="${srcdir}/"
678                 case "$d" in
679                 /*) try_srcdir= ;;
680                 esac
681                 try="${d}sysdeps$m0$m0sub$b$v$o$m$msub$a"
682                 test -n "$enable_debug_configure" &&
683                 echo "$0 [DEBUG]: try $try" >&2
684                 if test -d "$try_srcdir$try"; then
685                   sysnames="$sysnames $try"
686                   { test -n "$o" || test -n "$b"; } && os_used=t
687                   { test -n "$m" || test -n "$m0"; } && machine_used=t
688                   case x${m0:-$m} in
689                   x*/$submachine) submachine_used=t ;;
690                   esac
691                   if test -n "$d"; then
692                     case "$sysnames_add_ons" in
693                     *" $d "*) ;;
694                     *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
695                     esac
696                   fi
697                 fi
698               fi
699             done
700           done
701         done
702       done
703     done
704   done
705 done
707 if test -z "$os_used" && test "$os" != none; then
708   AC_MSG_ERROR(Operating system $os is not supported.)
710 if test -z "$machine_used" && test "$machine" != none; then
711   AC_MSG_ERROR(The $machine is not supported.)
713 if test -z "$submachine_used" && test -n "$submachine"; then
714   AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
716 AC_SUBST(submachine)
718 # We have now validated the configuration.
721 # If using ELF, look for an `elf' subdirectory of each machine directory.
722 # We prepend these rather than inserting them whereever the machine appears
723 # because things specified by the machine's ELF ABI should override
724 # OS-specific things, and should always be the same for any OS on the
725 # machine (otherwise what's the point of an ABI?).
726 if test "$elf" = yes; then
727   elf_dirs=
728   for d in $add_ons_pfx ''; do
729     for m in $mach; do
730       if test -d $srcdir/${d}sysdeps$m/elf; then
731         elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
732       fi
733     done
734   done
735   sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
739 # Expand the list of system names into a full list of directories
740 # from each element's parent name and Implies file (if present).
741 set $sysnames
742 names=
743 while test $# -gt 0; do
744   name=$1
745   shift
747   case " $names " in *" $name "*)
748     # Already in the list.
749     continue
750   esac
752   # Report each name as we discover it, so there is no long pause in output.
753   echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
755   name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
757   case $name in
758     /*) xsrcdir= ;;
759     *)  xsrcdir=$srcdir/ ;;
760   esac
761   test -n "$enable_debug_configure" &&
762   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
764   if test -f $xsrcdir$name/Implies; then
765     # Collect more names from the `Implies' file (removing comments).
766     implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
767     implied=
768     for x in $implied_candidate; do
769       found=no
770       if test -d $xsrcdir$name_base/$x; then
771         implied="$implied $name_base/$x";
772         found=yes
773       fi
774       for d in $add_ons_pfx ''; do
775         try="${d}sysdeps/$x"
776         case $d in
777          /*) try_srcdir= ;;
778          *) try_srcdir=$srcdir/ ;;
779         esac
780         test -n "$enable_debug_configure" &&
781          echo "[DEBUG]: $name implied $x try($d) {$try_srcdir}$try" >&2
782         if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
783         then
784           implied="$implied $try"
785           found=yes
786           case "$sysnames_add_ons" in
787           *" $d "*) ;;
788           *|'') sysnames_add_ons="$sysnames_add_ons $d" ;;
789           esac
790         fi
791       done
792       if test $found = no; then
793         AC_MSG_WARN($name/Implies specifies nonexistent $x)
794       fi
795     done
796   else
797     implied=
798   fi
800   # Add NAME to the list of names.
801   names="$names $name"
803   # Find the parent of NAME, using the empty string if it has none.
804 changequote(,)dnl
805   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
806 changequote([,])dnl
808   # Add the names implied by NAME, and NAME's parent (if it has one), to
809   # the list of names to be processed (the argument list).  We prepend the
810   # implied names to the list and append the parent.  We want implied
811   # directories to come before further directories inferred from the
812   # configuration components; this ensures that for sysv4, unix/common
813   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
814   # after sysv4).
815   sysnames="`echo $implied $* $parent`"
816   test -n "$sysnames" && set $sysnames
817 done
819 # Add the default directories.
820 default_sysnames=sysdeps/generic
821 if test "$elf" = yes; then
822   default_sysnames="sysdeps/generic/elf $default_sysnames"
824 sysnames="$names $default_sysnames"
825 AC_SUBST(sysnames)
826 # The other names were emitted during the scan.
827 AC_MSG_RESULT($default_sysnames)
829 # Collect the list of add-ons that supply partial sysdeps trees.
830 sysdeps_add_ons=
831 for add_on in $add_ons; do
832   case "$add_on" in
833   /*) xsrcdir= ;;
834   *) xsrcdir="$srcdir/" ;;
835   esac
837   test -d "$xsrcdir$add_on/sysdeps" || {
838     case "$configured_add_ons " in
839     *" $add_on "*) ;;
840     *|'')
841       AC_MSG_ERROR(add-on $add_on has no configure fragment or sysdeps tree)
842       ;;
843     esac
844     continue
845   }
847   sysdeps_add_ons="$sysdeps_add_ons $add_on"
848   case "$sysnames_add_ons" in
849   *" $add_on/ "*) ;;
850   *|'')
851     AC_MSG_WARN(add-on $add_on contributed no sysdeps directories)
852     continue ;;
853   esac
855   found=no
856   for d in $sysnames; do
857     case "$d" in
858     $add_on/sysdeps/*) ;;
859     *) continue ;;
860     esac
861     (cd "$xsrcdir$d" && for f in *[[!~]]; do
862        case "$f" in
863        sys|bits)
864          for ff in $f/*.h; do
865            test -d "$ff" || { test -e "$ff" && exit 88; }
866          done
867          ;;
868        *)
869          test -d "$f" || { test -e "$f" && exit 88; }
870          ;;
871        esac
872      done)
873     if test $? -eq 88; then
874       found=yes
875       break
876     fi
877   done
878   if test $found = no; then
879     AC_MSG_WARN(add-on $add_on contributed no useful sysdeps directories)
880   fi
881 done
882 AC_SUBST(sysdeps_add_ons)
885 ### Locate tools.
887 AC_PROG_INSTALL
888 if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
889   # The makefiles need to use a different form to find it in $srcdir.
890   INSTALL='\$(..)./scripts/install-sh -c'
892 AC_PROG_LN_S
894 LIBC_PROG_BINUTILS
895 AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
897 # Accept binutils 2.13 or newer.
898 AC_CHECK_PROG_VER(AS, $AS, --version,
899                   [GNU assembler.* \([0-9]*\.[0-9.]*\)],
900                   [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
901 AC_CHECK_PROG_VER(LD, $LD, --version,
902                   [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
903                   [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
905 # We need the physical current working directory.  We cannot use the
906 # "pwd -P" shell builtin since that's not portable.  Instead we try to
907 # find a pwd binary.  Note that assigning to the PWD environment
908 # variable might have some interesting side effects, so we don't do
909 # that.
910 AC_PATH_PROG(PWD_P, pwd, no)
911 if test "$PWD_P" = no; then
912   AC_MSG_ERROR(*** A pwd binary could not be found.)
915 # These programs are version sensitive.
916 AC_CHECK_TOOL_PREFIX
917 AC_CHECK_PROG_VER(CC, ${ac_tool_prefix}gcc ${ac_tool_prefix}cc, -v,
918   [version \([egcygnustpi-]*[0-9.]*\)], [3.4* | 4.[0-9]* ],
919   critic_missing="$critic_missing gcc")
920 AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
921   [GNU Make[^0-9]*\([0-9][0-9.]*\)],
922   [3.79* | 3.[89]*], critic_missing="$critic_missing make")
924 AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
925   [GNU gettext.* \([0-9]*\.[0-9.]*\)],
926   [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
927   MSGFMT=: aux_missing="$aux_missing msgfmt")
928 AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
929   [GNU texinfo.* \([0-9][0-9.]*\)],
930   [4.*],
931   MAKEINFO=: aux_missing="$aux_missing makeinfo")
932 AC_CHECK_PROG_VER(SED, sed, --version,
933   [GNU sed version \([0-9]*\.[0-9.]*\)],
934   [3.0[2-9]*|3.[1-9]*|[4-9]*],
935   SED=: aux_missing="$aux_missing sed")
937 AC_CHECK_PROGS(AUTOCONF, autoconf, no)
938 case "x$AUTOCONF" in
939 xno|x|x:) AUTOCONF=no ;;
941   AC_CACHE_CHECK(dnl
942 whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
943   if (cd $srcdir; $AUTOCONF $ACFLAGS configure.in > /dev/null 2>&1); then
944     libc_cv_autoconf_works=yes
945   else
946     libc_cv_autoconf_works=no
947   fi])
948   test $libc_cv_autoconf_works = yes || AUTOCONF=no
949   ;;
950 esac
951 if test "x$with_cvs" = xyes && test "x$AUTOCONF" = xno; then
952   # If --without-cvs they probably won't change configure.in, so no complaints.
953   aux_missing="$aux_missing autoconf"
956 test -n "$critic_missing" && AC_MSG_ERROR([
957 *** These critical programs are missing or too old:$critic_missing
958 *** Check the INSTALL file for required versions.])
960 test -n "$aux_missing" && AC_MSG_WARN([
961 *** These auxiliary programs are missing or incompatible versions:$aux_missing
962 *** some features will be disabled.
963 *** Check the INSTALL file for required versions.])
965 # if using special system headers, find out the compiler's sekrit
966 # header directory and add that to the list.  NOTE: Only does the right
967 # thing on a system that doesn't need fixincludes.  (Not presently a problem.)
968 if test -n "$sysheaders"; then
969   SYSINCLUDES=-nostdinc
970   for d in include include-fixed; do
971     i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
972     SYSINCLUDES="$SYSINCLUDES -isystem $i"
973   done
974   SYSINCLUDES="$SYSINCLUDES \
975 -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
976   if test -n "$CXX"; then
977     cxxversion=`$CXX -dumpversion 2>&AS_MESSAGE_LOG_FD` &&
978     cxxmachine=`$CXX -dumpmachine 2>&AS_MESSAGE_LOG_FD` &&
979     cxxheaders=`$CXX -print-file-name=../../../../include/c++/`"$cxxversion" &&
980     CXX_SYSINCLUDES="-isystem $cxxheaders \
981 -isystem $cxxheaders/$cxxmachine -isystem $cxxheaders/backward"
982   fi
984 AC_SUBST(SYSINCLUDES)
985 AC_SUBST(CXX_SYSINCLUDES)
987 # check if ranlib is necessary
988 AC_CACHE_CHECK(whether ranlib is necessary, libc_cv_ranlib_necessary, [dnl
989 cat > conftest.c <<EOF
990 int a;
991 char b;
992 void c(void) {}
994 $CC $CFLAGS $CPPFLAGS -c conftest.c
995 $AR cr conftest.a conftest.o
996 cp conftest.a conftest2.a
997 $RANLIB conftest.a
998 if cmp -s conftest.a conftest2.a; then
999   libc_cv_ranlib_necessary=no
1000 else
1001   libc_cv_ranlib_necessary=yes
1003 rm -rf conftest*])
1004 if test "$libc_cv_ranlib_necessary" = no; then
1005  RANLIB=:
1008 # Test if LD_LIBRARY_PATH contains the notation for the current directory
1009 # since this would lead to problems installing/building glibc.
1010 # LD_LIBRARY_PATH contains the current directory if one of the following
1011 # is true:
1012 # - one of the terminals (":" and ";") is the first or last sign
1013 # - two terminals occur directly after each other
1014 # - the path contains an element with a dot in it
1015 AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
1016 changequote(,)dnl
1017 case ${LD_LIBRARY_PATH} in
1018   [:\;]* | *[:\;] | *[:\;][:\;]* |  *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
1019     ld_library_path_setting="contains current directory"
1020     ;;
1021   *)
1022     ld_library_path_setting="ok"
1023     ;;
1024 esac
1025 changequote([,])dnl
1026 AC_MSG_RESULT($ld_library_path_setting)
1027 if test "$ld_library_path_setting" != "ok"; then
1028 AC_MSG_ERROR([
1029 *** LD_LIBRARY_PATH shouldn't contain the current directory when
1030 *** building glibc. Please change the environment variable
1031 *** and run configure again.])
1034 AC_CACHE_CHECK(whether GCC supports -static-libgcc, libc_cv_gcc_static_libgcc, [dnl
1035 if $CC -v -static-libgcc 2>&1 | grep -q 'unrecognized option.*static-libgcc'; then
1036   libc_cv_gcc_static_libgcc=
1037 else
1038   libc_cv_gcc_static_libgcc=-static-libgcc
1039 fi])
1040 AC_SUBST(libc_cv_gcc_static_libgcc)
1042 AC_PATH_PROG(BASH_SHELL, bash, no)
1043 if test "$BASH_SHELL" != no &&
1044    $BASH_SHELL -c 'test "$BASH_VERSINFO" \
1045              && test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
1046   libc_cv_have_bash2=yes
1047 else
1048   libc_cv_have_bash2=no
1050 AC_SUBST(libc_cv_have_bash2)
1052 dnl We need a ksh compatible shell for tzselect.
1053 if test "$BASH_SHELL" = no; then
1054   AC_PATH_PROG(KSH, ksh, no)
1055   if test "$KSH" = no; then
1056     libc_cv_have_ksh=no
1057   else
1058     libc_cv_have_ksh=yes
1059   fi
1060 else
1061   KSH="$BASH_SHELL"
1062   AC_SUBST(KSH)
1063   libc_cv_have_ksh=yes
1065 AC_SUBST(libc_cv_have_ksh)
1067 AC_PROG_AWK
1068 AC_PATH_PROG(PERL, perl, no)
1069 if test "$PERL" != no &&
1070    (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
1071   PERL=no
1073 AC_PATH_PROG(INSTALL_INFO, install-info, no,
1074              $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
1075 AC_PATH_PROG(BISON, bison, no, $PATH:/usr/local/bin:/usr/bin:/bin)
1077 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
1078 echo '#include <stddef.h>
1079 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
1080 if eval "$ac_cpp conftest.c 2>/dev/null" \
1081 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
1082   libc_cv_signed_size_t=no
1083 else
1084   libc_cv_signed_size_t=yes
1086 rm -f conftest*])
1087 if test $libc_cv_signed_size_t = yes; then
1088   dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
1089   cat >> confdefs.h <<\EOF
1090 #undef __SIZE_TYPE__
1091 #define __SIZE_TYPE__ unsigned
1095 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
1096 AC_TRY_COMPILE(dnl
1097 [#define __need_size_t
1098 #define __need_wchar_t
1099 #include <stddef.h>
1100 #define __need_NULL
1101 #include <stddef.h>], [size_t size; wchar_t wchar;
1102 #ifdef offsetof
1103 #error stddef.h ignored __need_*
1104 #endif
1105 if (&size == NULL || &wchar == NULL) abort ();],
1106                libc_cv_friendly_stddef=yes,
1107                libc_cv_friendly_stddef=no)])
1108 if test $libc_cv_friendly_stddef = yes; then
1109   config_vars="$config_vars
1110 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
1113 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
1114                libc_cv_need_minus_P, [dnl
1115 cat > conftest.S <<EOF
1116 #include "confdefs.h"
1117 /* Nothing whatsoever.  */
1119 if AC_TRY_COMMAND(${CC-cc} $CPPFLAGS $ASFLAGS -c conftest.S 1>&AS_MESSAGE_LOG_FD); then
1120   libc_cv_need_minus_P=no
1121 else
1122   libc_cv_need_minus_P=yes
1124 rm -f conftest*])
1125 if test $libc_cv_need_minus_P = yes; then
1126   config_vars="$config_vars
1127 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
1130 AC_MSG_CHECKING(whether .text pseudo-op must be used)
1131 AC_CACHE_VAL(libc_cv_dot_text, [dnl
1132 cat > conftest.s <<EOF
1133 .text
1135 libc_cv_dot_text=
1136 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1137   libc_cv_dot_text=.text
1139 rm -f conftest*])
1140 if test -z "$libc_cv_dot_text"; then
1141   AC_MSG_RESULT(no)
1142 else
1143   AC_MSG_RESULT(yes)
1146 AC_CACHE_CHECK(for assembler global-symbol directive,
1147                libc_cv_asm_global_directive, [dnl
1148 libc_cv_asm_global_directive=UNKNOWN
1149 for ac_globl in .globl .global .EXPORT; do
1150   cat > conftest.s <<EOF
1151         ${libc_cv_dot_text}
1152         ${ac_globl} foo
1153 foo:
1155   if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1156     libc_cv_asm_global_directive=${ac_globl}
1157   fi
1158   rm -f conftest*
1159   test $libc_cv_asm_global_directive != UNKNOWN && break
1160 done])
1161 if test $libc_cv_asm_global_directive = UNKNOWN; then
1162   AC_MSG_ERROR(cannot determine asm global directive)
1163 else
1164   AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
1167 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
1168 cat > conftest.s <<EOF
1169 ${libc_cv_dot_text}
1170 foo:
1171 .set glibc_conftest_frobozz,foo
1172 $libc_cv_asm_global_directive glibc_conftest_frobozz
1174 # The alpha-dec-osf1 assembler gives only a warning for `.set'
1175 # (but it doesn't work), so we must do a linking check to be sure.
1176 cat > conftest1.c <<\EOF
1177 extern int glibc_conftest_frobozz;
1178 void _start() { glibc_conftest_frobozz = 1; }
1180 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1181             -nostartfiles -nostdlib \
1182             -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1183   libc_cv_asm_set_directive=yes
1184 else
1185   libc_cv_asm_set_directive=no
1187 rm -f conftest*])
1188 if test $libc_cv_asm_set_directive = yes; then
1189   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
1192 AC_CACHE_CHECK(for assembler .type directive prefix,
1193                libc_cv_asm_type_prefix, [dnl
1194 libc_cv_asm_type_prefix=no
1195 for ac_try_prefix in '@' '%' '#'; do
1196   cat > conftest.s <<EOF
1197         ${libc_cv_dot_text}
1198         ${libc_cv_asm_global_directive} foo
1199         .type foo, ${ac_try_prefix}object
1200         .size foo, 1
1201 foo:
1202         .byte 1
1204   if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1205     libc_cv_asm_type_prefix=${ac_try_prefix}
1206   fi
1207   rm -f conftest*
1208   test "x$libc_cv_asm_type_prefix" != xno && break
1209 done])
1210 if test "x$libc_cv_asm_type_prefix" != xno; then
1211   AC_DEFINE_UNQUOTED(ASM_TYPE_DIRECTIVE_PREFIX, ${libc_cv_asm_type_prefix})
1214 AC_CACHE_CHECK(for assembler gnu_unique_object symbol type,
1215                libc_cv_asm_unique_object, [dnl
1216 cat > conftest.s <<EOF
1217 ${libc_cv_dot_text}
1218 _sym:
1219 .type _sym, ${libc_cv_asm_type_prefix}gnu_unique_object
1221 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1222   libc_cv_asm_unique_object=yes
1223 else
1224   libc_cv_asm_unique_object=no
1226 rm -f conftest*])
1227 if test $libc_cv_asm_unique_object = yes; then
1228   AC_DEFINE(HAVE_ASM_UNIQUE_OBJECT)
1231 # For the multi-arch option we need support in the assembler.
1232 if test "$multi_arch" = yes; then
1233   if test "x$libc_cv_asm_type_prefix" != xno; then
1234 AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
1235                libc_cv_asm_gnu_indirect_function, [dnl
1236 cat > conftest.s <<EOF
1237 .type foo,%gnu_indirect_function
1239 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
1240 then
1241   libc_cv_asm_gnu_indirect_function=yes
1242 else
1243   libc_cv_asm_gnu_indirect_function=no
1245 rm -f conftest*])
1246   else
1247     libc_cv_asm_gnu_indirect_function=no
1248   fi
1249   if test x"$libc_cv_asm_gnu_indirect_function" != xyes; then
1250     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
1251   fi
1254 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1255 [cat > conftest.s <<EOF
1256 ${libc_cv_dot_text}
1257 _sym:
1258 .symver _sym,sym@VERS
1260 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1261   libc_cv_asm_symver_directive=yes
1262 else
1263   libc_cv_asm_symver_directive=no
1265 rm -f conftest*])
1266 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1267 if test $libc_cv_asm_symver_directive = yes; then
1268   cat > conftest.s <<EOF
1269 ${libc_cv_dot_text}
1270 _sym:
1271 .symver _sym,sym@VERS
1273   cat > conftest.map <<EOF
1274 VERS_1 {
1275         global: sym;
1278 VERS_2 {
1279         global: sym;
1280 } VERS_1;
1282   if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1283     if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1284                                 -o conftest.so conftest.o
1285                                 -nostartfiles -nostdlib
1286                                 -Wl,--version-script,conftest.map
1287                        1>&AS_MESSAGE_LOG_FD]);
1288     then
1289       libc_cv_ld_version_script_option=yes
1290     else
1291       libc_cv_ld_version_script_option=no
1292     fi
1293   else
1294     libc_cv_ld_version_script_option=no
1295   fi
1296 else
1297   libc_cv_ld_version_script_option=no
1299 rm -f conftest*])
1300 if test $shared != no &&
1301    test $libc_cv_asm_symver_directive = yes &&
1302    test $libc_cv_ld_version_script_option = yes &&
1303    test $enable_versioning = yes; then
1304   VERSIONING=yes
1305   AC_DEFINE(DO_VERSIONING)
1306 else
1307   VERSIONING=no
1309 AC_SUBST(VERSIONING)
1311 if test $elf = yes && test $shared != no && test $VERSIONING = no; then
1312   echo "\
1313 *** WARNING: You should not compile GNU libc without versioning. Not using
1314 *** versioning will introduce incompatibilities so that old binaries
1315 *** will not run anymore.
1316 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1318 if test $elf = yes; then
1319   AC_CACHE_CHECK(for .previous assembler directive,
1320                  libc_cv_asm_previous_directive, [dnl
1321   cat > conftest.s <<EOF
1322 .section foo_section
1323 .previous
1325   if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1326     libc_cv_asm_previous_directive=yes
1327   else
1328     libc_cv_asm_previous_directive=no
1329   fi
1330   rm -f conftest*])
1331   if test $libc_cv_asm_previous_directive = yes; then
1332     AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1333   else
1334     AC_CACHE_CHECK(for .popsection assembler directive,
1335                    libc_cv_asm_popsection_directive, [dnl
1336     cat > conftest.s <<EOF
1337 .pushsection foo_section
1338 .popsection
1340     if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1341       libc_cv_asm_popsection_directive=yes
1342     else
1343       libc_cv_asm_popsection_directive=no
1344     fi
1345     rm -f conftest*])
1346     if test $libc_cv_asm_popsection_directive = yes; then
1347       AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1348     fi
1349   fi
1350   AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1351                  libc_cv_asm_protected_directive, [dnl
1352   cat > conftest.s <<EOF
1353 .protected foo
1354 foo:
1355 .hidden bar
1356 bar:
1358   if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1359     libc_cv_asm_protected_directive=yes
1360   else
1361     AC_MSG_ERROR(assembler support for symbol visibility is required)
1362   fi
1363   rm -f conftest*])
1365   if test $libc_cv_asm_protected_directive = yes; then
1366     AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1367                  libc_cv_visibility_attribute,
1368                  [cat > conftest.c <<EOF
1369                   int foo __attribute__ ((visibility ("hidden"))) = 1;
1370                   int bar __attribute__ ((visibility ("protected"))) = 1;
1372                   libc_cv_visibility_attribute=no
1373                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1374                     if grep '\.hidden.*foo' conftest.s >/dev/null; then
1375                       if grep '\.protected.*bar' conftest.s >/dev/null; then
1376                         libc_cv_visibility_attribute=yes
1377                       fi
1378                     fi
1379                   fi
1380                   rm -f conftest.[cs]
1381                  ])
1382     if test $libc_cv_visibility_attribute != yes; then
1383       AC_MSG_ERROR(compiler support for visibility attribute is required)
1384     fi
1385   fi
1387   if test $libc_cv_visibility_attribute = yes; then
1388     AC_CACHE_CHECK(for broken __attribute__((visibility())),
1389                  libc_cv_broken_visibility_attribute,
1390                  [cat > conftest.c <<EOF
1391                   int foo (int x);
1392                   int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1393                   int bar (int x) { return x; }
1395                   libc_cv_broken_visibility_attribute=yes
1396                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s1>&AS_MESSAGE_LOG_FD); then
1397 changequote(,)dnl
1398                     if grep '\.hidden[  _]foo' conftest.s >/dev/null; then
1399 changequote([,])dnl
1400                       libc_cv_broken_visibility_attribute=no
1401                     fi
1402                   fi
1403                   rm -f conftest.c conftest.s
1404                  ])
1405     if test $libc_cv_broken_visibility_attribute = yes; then
1406       AC_MSG_ERROR(working compiler support for visibility attribute is required)
1407     fi
1408   fi
1410   AC_CACHE_CHECK(for broken __attribute__((alias())),
1411                  libc_cv_broken_alias_attribute,
1412                  [cat > conftest.c <<EOF
1413                   extern int foo (int x) __asm ("xyzzy");
1414                   int bar (int x) { return x; }
1415                   extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1416                   extern int dfoo;
1417                   extern __typeof (dfoo) dfoo __asm ("abccb");
1418                   int dfoo = 1;
1420                   libc_cv_broken_alias_attribute=yes
1421                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1422                     if grep 'xyzzy' conftest.s >/dev/null &&
1423                        grep 'abccb' conftest.s >/dev/null; then
1424                       libc_cv_broken_alias_attribute=no
1425                     fi
1426                   fi
1427                   rm -f conftest.c conftest.s
1428                  ])
1429   if test $libc_cv_broken_alias_attribute = yes; then
1430     AC_MSG_ERROR(working alias attribute support required)
1431   fi
1433   if test $libc_cv_visibility_attribute = yes; then
1434     AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1435                  libc_cv_have_sdata_section,
1436                  [echo "int i;" > conftest.c
1437                   libc_cv_have_sdata_section=no
1438                   if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1439                      | grep '\.sdata' >/dev/null; then
1440                     libc_cv_have_sdata_section=yes
1441                   fi
1442                   rm -f conftest.c conftest.so
1443                  ])
1444     if test $libc_cv_have_sdata_section = yes; then
1445       AC_DEFINE(HAVE_SDATA_SECTION)
1446     fi
1447   fi
1449   AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1450                  libc_cv_initfini_array, [dnl
1451   cat > conftest.c <<EOF
1452 int _start (void) { return 0; }
1453 int __start (void) { return 0; }
1454 int foo (void) { return 1; }
1455 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1457   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
1458                      -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
1459   then
1460     if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
1461       libc_cv_initfini_array=yes
1462     else
1463       libc_cv_initfini_array=no
1464     fi
1465   else
1466     libc_cv_initfini_array=no
1467   fi
1468   rm -f conftest*])
1469   if test $libc_cv_initfini_array != yes; then
1470     AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1471   fi
1473   AC_CACHE_CHECK(for libunwind-support in compiler,
1474                  libc_cv_cc_with_libunwind, [
1475     cat > conftest.c <<EOF
1476 int main (void) { return 0; }
1478     if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1479        conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
1480       libc_cv_cc_with_libunwind=yes
1481     else
1482       libc_cv_cc_with_libunwind=no
1483     fi
1484     rm -f conftest*])
1485   AC_SUBST(libc_cv_cc_with_libunwind)
1486   if test $libc_cv_cc_with_libunwind = yes; then
1487     AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1488   fi
1490   AC_CACHE_CHECK(for -z nodelete option,
1491                  libc_cv_z_nodelete, [dnl
1492   cat > conftest.c <<EOF
1493 int _start (void) { return 42; }
1495   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1496                      -fPIC -shared -o conftest.so conftest.c
1497                      -nostartfiles -nostdlib
1498                      -Wl,--enable-new-dtags,-z,nodelete 1>&AS_MESSAGE_LOG_FD])
1499   then
1500     libc_cv_z_nodelete=yes
1501   else
1502     AC_MSG_ERROR(linker with -z nodelete support required)
1503   fi
1504   rm -f conftest*])
1506   AC_CACHE_CHECK(for -z nodlopen option,
1507                  libc_cv_z_nodlopen, [dnl
1508   cat > conftest.c <<EOF
1509 int _start (void) { return 42; }
1511   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1512                         -fPIC -shared -o conftest.so conftest.c
1513                         -nostartfiles -nostdlib
1514                         -Wl,--enable-new-dtags,-z,nodlopen 1>&AS_MESSAGE_LOG_FD])
1515   then
1516     libc_cv_z_nodlopen=yes
1517   else
1518     AC_MSG_ERROR(linker with -z nodlopen support required)
1519   fi
1520   rm -f conftest*])
1522   AC_CACHE_CHECK(for -z initfirst option,
1523                  libc_cv_z_initfirst, [dnl
1524   cat > conftest.c <<EOF
1525 int _start (void) { return 42; }
1527   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1528                         -fPIC -shared -o conftest.so conftest.c
1529                         -nostartfiles -nostdlib
1530                         -Wl,--enable-new-dtags,-z,initfirst 1>&AS_MESSAGE_LOG_FD])
1531   then
1532     libc_cv_z_initfirst=yes
1533   else
1534     AC_MSG_ERROR(linker with -z initfirst support required)
1535   fi
1536   rm -f conftest*])
1538   case "$base_machine" in
1539 changequote(,)dnl
1540     i[34567]86 | x86_64 | powerpc* | s390* | sparc* | alpha*)
1541 changequote([,])dnl
1542       AC_CACHE_CHECK(for -z relro option,
1543                      libc_cv_z_relro, [dnl
1544   libc_cv_z_relro=no
1545   if AC_TRY_COMMAND([${CC-cc} -v --help 2>&1|grep "z relro" 1>&AS_MESSAGE_LOG_FD])
1546   then
1547     if AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1|grep DATA_SEGMENT_RELRO_END 1>&AS_MESSAGE_LOG_FD])
1548     then
1549       libc_cv_z_relro=yes
1550     fi
1551   fi])
1552       if test "$libc_cv_z_relro" = no; then
1553         AC_MSG_ERROR(linker with -z relro support required)
1554       fi
1555       ;;
1556     *) ;;
1557    esac
1559   AC_CACHE_CHECK(for -Bgroup option,
1560                  libc_cv_Bgroup, [dnl
1561   cat > conftest.c <<EOF
1562 int _start (void) { return 42; }
1564   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1565                               -fPIC -shared -o conftest.so conftest.c
1566                               -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1567   then
1568     libc_cv_Bgroup=yes
1569   else
1570     libc_cv_Bgroup=no
1571   fi
1572   rm -f conftest*])
1573   AC_SUBST(libc_cv_Bgroup)
1575   AC_CACHE_CHECK(for libgcc_s suffix,
1576                  libc_cv_libgcc_s_suffix, [dnl
1577   cat > conftest.c <<EOF
1578 int main (void) { return 0; }
1580 changequote(,)dnl
1581   libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1582                            -fPIC -shared -shared-libgcc -o conftest.so \
1583                            conftest.c -v 2>&1 >/dev/null \
1584                            | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1585 changequote([,])dnl
1586   rm -f conftest*])
1587   AC_SUBST(libc_cv_libgcc_s_suffix)
1589   AC_CACHE_CHECK(for --as-needed option,
1590                  libc_cv_as_needed, [dnl
1591   cat > conftest.c <<EOF
1592 int main (void) { return 0; }
1594   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1595                               -fPIC -shared -o conftest.so conftest.c
1596                               -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
1597                               -nostdlib 1>&AS_MESSAGE_LOG_FD])
1598   then
1599     libc_cv_as_needed=yes
1600   else
1601     libc_cv_as_needed=no
1602   fi
1603   rm -f conftest*])
1604   AC_SUBST(libc_cv_as_needed)
1606   ASFLAGS_config=
1607   AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1608                  libc_cv_as_noexecstack, [dnl
1609   cat > conftest.c <<EOF
1610 void foo (void) { }
1612   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1613                      -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1614      && grep -q .note.GNU-stack conftest.s \
1615      && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1616                        -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1617   then
1618     libc_cv_as_noexecstack=yes
1619   else
1620     libc_cv_as_noexecstack=no
1621   fi
1622   rm -f conftest*])
1623   if test $libc_cv_as_noexecstack = yes; then
1624     ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1625   fi
1626   AC_SUBST(ASFLAGS_config)
1628   AC_CACHE_CHECK(for -z combreloc,
1629                  libc_cv_z_combreloc, [dnl
1630   cat > conftest.c <<EOF
1631 extern int bar (int);
1632 extern int mumble;
1633 int foo (void) { return bar (mumble); }
1635   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1636                         -fPIC -shared -o conftest.so conftest.c
1637                         -nostdlib -nostartfiles
1638                         -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1639   then
1640 dnl The following test is a bit weak.  We must use a tool which can test
1641 dnl cross-platform since the gcc used can be a cross compiler.  Without
1642 dnl introducing new options this is not easily doable.  Instead use a tool
1643 dnl which always is cross-platform: readelf.  To detect whether -z combreloc
1644 dnl look for a section named .rel.dyn.
1645     if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1646       libc_cv_z_combreloc=yes
1647     else
1648       libc_cv_z_combreloc=no
1649     fi
1650   else
1651     libc_cv_z_combreloc=no
1652   fi
1653   rm -f conftest*])
1654   if test "$libc_cv_z_combreloc" = yes; then
1655     AC_DEFINE(HAVE_Z_COMBRELOC)
1656   fi
1657   AC_SUBST(libc_cv_z_combreloc)
1659   AC_CACHE_CHECK(for -z execstack,
1660                  libc_cv_z_execstack, [dnl
1661   cat > conftest.c <<EOF
1662 int _start (void) { return 42; }
1664   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1665                               -fPIC -shared -o conftest.so conftest.c
1666                               -Wl,-z,execstack -nostdlib
1667                               1>&AS_MESSAGE_LOG_FD])
1668   then
1669     libc_cv_z_execstack=yes
1670   else
1671     libc_cv_z_execstack=no
1672   fi
1673   rm -f conftest*])
1674   AC_SUBST(libc_cv_z_execstack)
1676   AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1677   cat > conftest.c <<EOF
1678 int foo;
1679 main () { return 0;}
1681   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
1682                               -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1683   then
1684     libc_cv_fpie=yes
1685   else
1686     libc_cv_fpie=no
1687   fi
1688   rm -f conftest*])
1690   AC_SUBST(libc_cv_fpie)
1692   AC_CACHE_CHECK(for --hash-style option,
1693                  libc_cv_hashstyle, [dnl
1694   cat > conftest.c <<EOF
1695 int _start (void) { return 42; }
1697   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1698                               -fPIC -shared -o conftest.so conftest.c
1699                               -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1700   then
1701     libc_cv_hashstyle=yes
1702   else
1703     libc_cv_hashstyle=no
1704   fi
1705   rm -f conftest*])
1706   AC_SUBST(libc_cv_hashstyle)
1709 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1710 cat > conftest.c <<EOF
1711 int foo;
1713 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1714                             conftest.c 1>&AS_MESSAGE_LOG_FD])
1715 then
1716   libc_cv_fno_toplevel_reorder=yes
1717 else
1718   libc_cv_fno_toplevel_reorder=no
1720 rm -f conftest*])
1721 if test $libc_cv_fno_toplevel_reorder = yes; then
1722   fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1723 else
1724   fno_unit_at_a_time=-fno-unit-at-a-time
1726 AC_SUBST(fno_unit_at_a_time)
1728 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1729 cat > conftest.c <<EOF
1730 int foo;
1731 main () { return 0;}
1733 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
1734                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1735 then
1736   libc_cv_ssp=yes
1737 else
1738   libc_cv_ssp=no
1740 rm -f conftest*])
1741 AC_SUBST(libc_cv_ssp)
1743 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1744 cat > conftest.c <<EOF
1745 int foo;
1746 #ifdef __GNUC_GNU_INLINE__
1747 main () { return 0;}
1748 #else
1749 #error
1750 #endif
1752 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1753                             -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1754 then
1755   libc_cv_gnu89_inline=yes
1756 else
1757   libc_cv_gnu89_inline=no
1759 rm -f conftest*])
1760 if test $libc_cv_gnu89_inline = yes; then
1761   libc_cv_gnu89_inline=-fgnu89-inline
1762 else
1763   libc_cv_gnu89_inline=
1765 AC_SUBST(libc_cv_gnu89_inline)
1767 if test $elf != yes; then
1768   AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
1769                  [AC_TRY_COMPILE(, [asm (".section .init");
1770                                     asm (".section .fini");
1771                                     asm ("${libc_cv_dot_text}");],
1772                                  libc_cv_have_initfini=yes,
1773                                  libc_cv_have_initfini=no)])
1774   AC_SUBST(libc_cv_have_initfini)dnl
1775   if test $libc_cv_have_initfini = yes; then
1776     AC_DEFINE(HAVE_INITFINI)
1777   fi
1780 if test $elf = yes; then
1781   AC_CACHE_CHECK(whether cc puts quotes around section names,
1782                  libc_cv_have_section_quotes,
1783                  [cat > conftest.c <<EOF
1784                   static const int foo
1785                   __attribute__ ((section ("bar"))) = 1;
1787                   if ${CC-cc} -S conftest.c -o conftest.s; then
1788                     if grep '\.section.*"bar"' conftest.s >/dev/null; then
1789                       libc_cv_have_section_quotes=yes
1790                     else
1791                       libc_cv_have_section_quotes=no
1792                     fi
1793                   else
1794                     libc_cv_have_section_quotes=unknown
1795                   fi
1796                   rm -f conftest.[cs]
1797                  ])
1798   if test $libc_cv_have_section_quotes = yes; then
1799     AC_DEFINE(HAVE_SECTION_QUOTES)
1800   fi
1803 dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1804 AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
1805 [cat > conftest.$ac_ext <<EOF
1806 dnl This sometimes fails to find confdefs.h, for some reason.
1807 dnl [#]line $LINENO "[$]0"
1808 [#]line $LINENO "configure"
1809 #include "confdefs.h"
1810 void underscore_test(void) {
1811 return; }
1813 if AC_TRY_EVAL(ac_compile); then
1814   if grep _underscore_test conftest* >/dev/null; then
1815     ifelse([$1], , :, [rm -f conftest*
1816     $1])
1817   else
1818     ifelse([$2], , , [rm -f conftest*
1819     $2])
1820   fi
1821 else
1822   echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
1823   cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
1824   ifelse([$2], , , [rm -f conftest*
1825   $2])
1827 rm -f conftest*])
1829 if test $elf = yes; then
1830   libc_cv_asm_underscores=no
1831 else
1832   if test $ac_cv_prog_cc_works = yes; then
1833     AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1834                    [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
1835                                 libc_cv_asm_underscores=yes,
1836                                 libc_cv_asm_underscores=no)])
1837   else
1838     AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1839                    [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
1840                                             libc_cv_asm_underscores=no)])
1841   fi
1843 if test $libc_cv_asm_underscores = no; then
1844   AC_DEFINE(NO_UNDERSCORES)
1847 if test $elf = yes; then
1848   libc_cv_weak_symbols=yes
1851 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1852                [dnl
1853 cat > conftest.s <<EOF
1854 ${libc_cv_dot_text}
1855 ${libc_cv_asm_global_directive} foo
1856 foo:
1857 .weak foo
1858 .weak bar; bar = foo
1860 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1861   libc_cv_asm_weak_directive=yes
1862 else
1863   libc_cv_asm_weak_directive=no
1865 rm -f conftest*])
1867 if test $libc_cv_asm_weak_directive = no; then
1868   AC_CACHE_CHECK(for assembler .weakext directive,
1869                  libc_cv_asm_weakext_directive,
1870                  [dnl
1871 cat > conftest.s <<EOF
1872 ${libc_cv_dot_text}
1873 ${libc_cv_asm_global_directive} foo
1874 foo:
1875 .weakext bar foo
1876 .weakext baz
1877 ${libc_cv_asm_global_directive} baz
1878 baz:
1880   if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1881     libc_cv_asm_weakext_directive=yes
1882   else
1883     libc_cv_asm_weakext_directive=no
1884   fi
1885   rm -f conftest*])
1887 fi # no .weak
1889 if test $libc_cv_asm_weak_directive = yes; then
1890   AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1891 elif test $libc_cv_asm_weakext_directive = yes; then
1892   AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1895 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
1896 case $machine in
1897   sparc/sparc64*) cfi_offset=2047;;
1898   *) cfi_offset=0;;
1899 esac
1900 cat > conftest.s <<EOF
1901         .text
1902         .type   func,%function
1903 func:
1904         .cfi_startproc
1905         .cfi_remember_state
1906         .cfi_rel_offset 1, $cfi_offset
1907         .cfi_endproc
1909 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1910   libc_cv_asm_cfi_directives=yes
1911 else
1912   libc_cv_asm_cfi_directives=no
1914 rm -f conftest*])
1915 if test $libc_cv_asm_cfi_directives = yes; then
1916   AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
1919 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1920 cat > conftest.c <<\EOF
1921 _start () {}
1922 int __eh_pc;
1923 __throw () {}
1925 dnl No \ in command here because it ends up inside ''.
1926 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1927                             -nostdlib -nostartfiles -Wl,--no-whole-archive
1928                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1929   libc_cv_ld_no_whole_archive=yes
1930 else
1931   libc_cv_ld_no_whole_archive=no
1933 rm -f conftest*])
1934 if test $libc_cv_ld_no_whole_archive = yes; then
1935   no_whole_archive=-Wl,--no-whole-archive
1937 AC_SUBST(no_whole_archive)dnl
1939 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
1940 cat > conftest.c <<\EOF
1941 _start () {}
1942 int __eh_pc;
1943 __throw () {}
1945 dnl No \ in command here because it ends up inside ''.
1946 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1947                             -nostdlib -nostartfiles -fexceptions
1948                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1949   libc_cv_gcc_exceptions=yes
1950 else
1951   libc_cv_gcc_exceptions=no
1953 rm -f conftest*])
1954 if test $libc_cv_gcc_exceptions = yes; then
1955   exceptions=-fexceptions
1957 AC_SUBST(exceptions)dnl
1959 if test "$host_cpu" = powerpc ; then
1960 # Check for a bug present in at least versions 2.8.x of GCC
1961 # and versions 1.0.x of EGCS.
1962 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
1963 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
1964                libc_cv_c_asmcr0_bug='no',
1965                libc_cv_c_asmcr0_bug='yes')])
1966 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
1967   AC_DEFINE(BROKEN_PPC_ASM_CR0)
1971 dnl Check whether compiler understands __builtin_expect.
1972 AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
1973 [cat > conftest.c <<EOF
1974 #line $LINENO "configure"
1975 int foo (int a)
1977   a = __builtin_expect (a, 10);
1978   return a == 10 ? 0 : 1;
1981 dnl No \ in command here because it ends up inside ''.
1982 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
1983                             -o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
1984   libc_cv_gcc_builtin_expect=yes
1985 else
1986   libc_cv_gcc_builtin_expect=no
1988 rm -f conftest*])
1989 if test "$libc_cv_gcc_builtin_expect" = yes; then
1990   AC_DEFINE(HAVE_BUILTIN_EXPECT)
1993 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1994 cat > conftest.c <<\EOF
1995 void zero (void *x)
1997   __builtin_memset (x, 0, 1000);
2001 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
2002 then
2003   libc_cv_gcc_builtin_memset=no
2004 else
2005   libc_cv_gcc_builtin_memset=yes
2007 rm -f conftest* ])
2008 if test "$libc_cv_gcc_builtin_memset" = yes ; then
2009   AC_DEFINE(HAVE_BUILTIN_MEMSET)
2012 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
2013 cat > conftest.c <<\EOF
2014 extern char *strstr (const char *, const char *) __asm ("my_strstr");
2015 char *foo (const char *a, const char *b)
2017   return __builtin_strstr (a, b);
2021 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
2022 then
2023   libc_cv_gcc_builtin_redirection=yes
2024 else
2025   libc_cv_gcc_builtin_redirection=no
2027 rm -f conftest* ])
2028 if test "$libc_cv_gcc_builtin_redirection" = yes ; then
2029   AC_DEFINE(HAVE_BUILTIN_REDIRECTION)
2032 dnl Check whether the compiler supports the __thread keyword.
2033 if test "x$use__thread" != xno; then
2034   AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
2035   [cat > conftest.c <<\EOF
2036 __thread int a = 42;
2038   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
2039     libc_cv_gcc___thread=yes
2040   else
2041     libc_cv_gcc___thread=no
2042   fi
2043   rm -f conftest*])
2044   if test "$libc_cv_gcc___thread" = yes; then
2045     AC_DEFINE(HAVE___THREAD)
2046   fi
2047 else
2048   libc_cv_gcc___thread=no
2051 if test "$libc_cv_gcc___thread" = yes; then
2052   dnl Check whether the compiler supports the tls_model attribute.
2053   AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
2054   cat > conftest.c <<\EOF
2055 extern __thread int a __attribute__((tls_model ("initial-exec")));
2057   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
2058     libc_cv_gcc_tls_model_attr=yes
2059   else
2060     libc_cv_gcc_tls_model_attr=no
2061   fi
2062   rm -f conftest*])
2063   if test "$libc_cv_gcc_tls_model_attr" = yes; then
2064     AC_DEFINE(HAVE_TLS_MODEL_ATTRIBUTE)
2065   fi
2068 if test -n "$submachine"; then
2069   AC_CACHE_CHECK([for compiler option for CPU variant],
2070                  libc_cv_cc_submachine, [dnl
2071   libc_cv_cc_submachine=no
2072   for opt in "-march=$submachine" "-mcpu=$submachine"; do
2073     if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
2074       libc_cv_cc_submachine="$opt"
2075       break
2076     fi
2077   done])
2078   if test "x$libc_cv_cc_submachine" = xno; then
2079     AC_MSG_ERROR([${CC-cc} does not support $submachine])
2080   fi
2082 AC_SUBST(libc_cv_cc_submachine)
2084 dnl Check whether we have the gd library available.
2085 AC_MSG_CHECKING(for libgd)
2086 if test "$with_gd" != "no"; then
2087   old_CFLAGS="$CFLAGS"
2088   CFLAGS="$CFLAGS $libgd_include"
2089   old_LDFLAGS="$LDFLAGS"
2090   LDFLAGS="$LDFLAGS $libgd_ldflags"
2091   old_LIBS="$LIBS"
2092   LIBS="$LIBS -lgd -lpng -lz -lm"
2093   AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2094   CFLAGS="$old_CFLAGS"
2095   LDFLAGS="$old_LDFLAGS"
2096   LIBS="$old_LIBS"
2097 else
2098   LIBGD=no
2100 AC_MSG_RESULT($LIBGD)
2101 AC_SUBST(LIBGD)
2103 # SELinux detection
2104 if test x$with_selinux = xno ; then
2105   have_selinux=no;
2106 else
2107   # See if we have the SELinux library
2108   AC_CHECK_LIB(selinux, is_selinux_enabled,
2109                have_selinux=yes, have_selinux=no)
2110   # See if we have the SELinux header with the NSCD permissions in it.
2111   if test x$have_selinux = xyes ; then
2112     AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2113     AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2114                     [#ifdef NSCD__SHMEMHOST
2115                      return 0;
2116                      #else
2117                      #error NSCD__SHMEMHOST not defined
2118                      #endif],
2119                     have_selinux=yes, have_selinux=no)
2120     AC_MSG_RESULT($have_selinux)
2121   fi
2123   if test x$with_selinux = xyes ; then
2124     if test x$have_selinux = xno ; then
2125       AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2126     fi
2127   fi
2129 # Check if we're building with SELinux support.
2130 if test "x$have_selinux" = xyes; then
2131   AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2133   # See if we have the libaudit library
2134   AC_CHECK_LIB(audit, audit_log_user_avc_message,
2135                have_libaudit=yes, have_libaudit=no)
2136   if test "x$have_libaudit" = xyes; then
2137     AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2138   fi
2139   AC_SUBST(have_libaudit)
2141   # See if we have the libcap library
2142   AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2143   if test "x$have_libcap" = xyes; then
2144     AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2145   fi
2146   AC_SUBST(have_libcap)
2148 AC_SUBST(have_selinux)
2150 dnl check for the size of 'long double'.
2151 AC_CHECK_SIZEOF(long double, 0)
2152 sizeof_long_double=$ac_cv_sizeof_long_double
2153 AC_SUBST(sizeof_long_double)
2155 ### End of automated tests.
2156 ### Now run sysdeps configure fragments.
2158 # They also can set these variables.
2159 use_ldconfig=no
2160 ldd_rewrite_script=no
2161 libc_cv_sysconfdir=$sysconfdir
2162 libc_cv_gcc_unwind_find_fde=no
2163 libc_cv_idn=no
2165 # Iterate over all the sysdep directories we will use, running their
2166 # configure fragments, and looking for a uname implementation.
2167 uname=
2168 for dir in $sysnames; do
2169   case $dir in
2170     /*) dest=$dir ;;
2171     *)  dest=$srcdir/$dir ;;
2172   esac
2173   if test -r $dest/configure; then
2174     AC_MSG_RESULT(running configure fragment for $dir)
2175     . $dest/configure
2176   fi
2178   if test -z "$uname"; then
2179     if test -r $dest/uname.c ||
2180        test -r $dest/uname.S ||
2181        { test -r $dest/syscalls.list &&
2182          grep '^uname[  ]' $dest/syscalls.list >/dev/null; }; then
2183       uname=$dir
2184     fi
2185   fi
2186 ]dnl
2187 done
2189 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2190   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2192 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2194 # If we will use the generic uname implementation, we must figure out what
2195 # it will say by examining the system, and write the results in config-name.h.
2196 if test "$uname" = "sysdeps/generic"; then
2198 changequote(,)dnl
2199   uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
2200 changequote([,])dnl
2201   if test $uname_sysname != $config_os; then
2202     config_release=`echo $config_os | sed s/$uname_sysname//`
2203   fi
2205 AC_DEFUN(LIBC_KERNEL_ID, [dnl
2206     if test -r /vmunix; then
2207       kernel_id=`strings /vmunix | grep UNIX`
2208     elif test -r /dynix; then
2209       kernel_id=`strings /dynix | grep DYNIX`
2210     else
2211       kernel_id=
2212     fi
2213 ])dnl
2215   AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
2216 LIBC_KERNEL_ID
2217 changequote(,)dnl
2218   kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
2219 changequote([,])dnl
2220   if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
2221          != x$config_release; then
2222     # The configuration release is a substring of the kernel release.
2223     libc_cv_uname_release=$kernel_release
2224   elif test x$config_release != x; then
2225     libc_cv_uname_release=$config_release
2226   elif test x$kernel_release != x; then
2227     libc_cv_uname_release=$kernel_release
2228   else
2229     libc_cv_uname_release=unknown
2230   fi])
2231   uname_release="$libc_cv_uname_release"
2233   AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
2234 LIBC_KERNEL_ID
2235 changequote(,)dnl
2236   kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
2237 changequote([,])dnl
2238   if test -n "$kernel_version"; then
2239     libc_cv_uname_version="$kernel_version"
2240   else
2241     libc_cv_uname_version=unknown
2242   fi])
2243   uname_version="$libc_cv_uname_version"
2245 AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
2246   config_uname=config-name.h:config-name.in
2247 else
2248   # For non-generic uname, we don't need to create config-name.h at all.
2249   config_uname=
2252 dnl This is tested by existing code and it's simpler to avoid changing it.
2253 AC_DEFINE(USE_IN_LIBIO)
2255 # Test for old glibc 2.0.x headers so that they can be removed properly
2256 # Search only in includedir.
2257 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2258 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2259 then
2260   old_glibc_headers=yes
2261 else
2262   old_glibc_headers=no
2264 AC_MSG_RESULT($old_glibc_headers)
2265 if test ${old_glibc_headers} = yes; then
2266   AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2267   AC_MSG_WARN(*** be removed.)
2269 AC_SUBST(old_glibc_headers)
2271 AC_SUBST(libc_cv_slibdir)
2272 AC_SUBST(libc_cv_localedir)
2273 AC_SUBST(libc_cv_sysconfdir)
2274 AC_SUBST(libc_cv_rootsbindir)
2275 AC_SUBST(libc_cv_forced_unwind)
2277 dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
2278 AC_SUBST(libc_cv_cpp_asm_debuginfo)
2279 AC_SUBST(libc_cv_cc_sse4)
2280 AC_SUBST(libc_cv_cc_avx)
2282 AC_SUBST(use_ldconfig)
2283 AC_SUBST(ldd_rewrite_script)
2285 AC_SUBST(elf) AC_SUBST(xcoff)
2286 if test $elf = yes; then
2287   AC_DEFINE(HAVE_ELF)
2289 if test $xcoff = yes; then
2290   AC_DEFINE(HAVE_XCOFF)
2293 AC_SUBST(static)
2294 AC_SUBST(shared)
2295 if test $shared = default; then
2296   shared=$elf
2299 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2300 [libc_cv_pic_default=yes
2301 cat > conftest.c <<EOF
2302 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2303 # error PIC is default.
2304 #endif
2306 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2307   libc_cv_pic_default=no
2309 rm -f conftest.*])
2310 AC_SUBST(libc_cv_pic_default)
2312 AC_SUBST(profile)
2313 AC_SUBST(omitfp)
2314 AC_SUBST(bounded)
2315 AC_SUBST(static_nss)
2316 AC_SUBST(nopic_initfini)
2318 AC_SUBST(DEFINES)
2320 dnl See sysdeps/mach/configure.in for this variable.
2321 AC_SUBST(mach_interface_list)
2323 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
2324   config_makefile=
2325 else
2326   config_makefile=Makefile
2329 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2330 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2331 AC_SUBST(VERSION)
2332 AC_SUBST(RELEASE)
2334 AC_CONFIG_FILES([config.make ${config_makefile} ${config_uname}])
2335 AC_CONFIG_COMMANDS([default],[[
2336 case $CONFIG_FILES in *config.make*)
2337 echo "$config_vars" >> config.make;;
2338 esac
2339 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
2340 AC_OUTPUT