Test for ELF IFUNC functionality.
[glibc.git] / configure.in
blob6a92bd876aa3ab37589ac72265c8929ad6fbc6f1
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 # For the multi-arch option we need support in the assembler.
1215 if test "$multi_arch" = yes; then
1216   if test "x$libc_cv_asm_type_prefix" != xno; then
1217 AC_CACHE_CHECK([for assembler gnu_indirect_function symbol type support],
1218                libc_cv_asm_gnu_indirect_function, [dnl
1219 cat > conftest.s <<EOF
1220 .type foo,%gnu_indirect_function
1222 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD;
1223 then
1224   libc_cv_asm_gnu_indirect_function=yes
1225 else
1226   libc_cv_asm_gnu_indirect_function=no
1228 rm -f conftest*])
1229   else
1230     libc_cv_asm_gnu_indirect_function=no
1231   fi
1232   if test x"$libc_cv_asm_gnu_indirect_function" != xyes; then
1233     AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
1234   fi
1237 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
1238 [cat > conftest.s <<EOF
1239 ${libc_cv_dot_text}
1240 _sym:
1241 .symver _sym,sym@VERS
1243 if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1244   libc_cv_asm_symver_directive=yes
1245 else
1246   libc_cv_asm_symver_directive=no
1248 rm -f conftest*])
1249 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
1250 if test $libc_cv_asm_symver_directive = yes; then
1251   cat > conftest.s <<EOF
1252 ${libc_cv_dot_text}
1253 _sym:
1254 .symver _sym,sym@VERS
1256   cat > conftest.map <<EOF
1257 VERS_1 {
1258         global: sym;
1261 VERS_2 {
1262         global: sym;
1263 } VERS_1;
1265   if ${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
1266     if AC_TRY_COMMAND([${CC-cc} $CFLAGS $LDFLAGS -shared
1267                                 -o conftest.so conftest.o
1268                                 -nostartfiles -nostdlib
1269                                 -Wl,--version-script,conftest.map
1270                        1>&AS_MESSAGE_LOG_FD]);
1271     then
1272       libc_cv_ld_version_script_option=yes
1273     else
1274       libc_cv_ld_version_script_option=no
1275     fi
1276   else
1277     libc_cv_ld_version_script_option=no
1278   fi
1279 else
1280   libc_cv_ld_version_script_option=no
1282 rm -f conftest*])
1283 if test $shared != no &&
1284    test $libc_cv_asm_symver_directive = yes &&
1285    test $libc_cv_ld_version_script_option = yes &&
1286    test $enable_versioning = yes; then
1287   VERSIONING=yes
1288   AC_DEFINE(DO_VERSIONING)
1289 else
1290   VERSIONING=no
1292 AC_SUBST(VERSIONING)
1294 if test $elf = yes && test $shared != no && test $VERSIONING = no; then
1295   echo "\
1296 *** WARNING: You should not compile GNU libc without versioning. Not using
1297 *** versioning will introduce incompatibilities so that old binaries
1298 *** will not run anymore.
1299 *** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
1301 if test $elf = yes; then
1302   AC_CACHE_CHECK(for .previous assembler directive,
1303                  libc_cv_asm_previous_directive, [dnl
1304   cat > conftest.s <<EOF
1305 .section foo_section
1306 .previous
1308   if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1309     libc_cv_asm_previous_directive=yes
1310   else
1311     libc_cv_asm_previous_directive=no
1312   fi
1313   rm -f conftest*])
1314   if test $libc_cv_asm_previous_directive = yes; then
1315     AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
1316   else
1317     AC_CACHE_CHECK(for .popsection assembler directive,
1318                    libc_cv_asm_popsection_directive, [dnl
1319     cat > conftest.s <<EOF
1320 .pushsection foo_section
1321 .popsection
1323     if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1324       libc_cv_asm_popsection_directive=yes
1325     else
1326       libc_cv_asm_popsection_directive=no
1327     fi
1328     rm -f conftest*])
1329     if test $libc_cv_asm_popsection_directive = yes; then
1330       AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
1331     fi
1332   fi
1333   AC_CACHE_CHECK(for .protected and .hidden assembler directive,
1334                  libc_cv_asm_protected_directive, [dnl
1335   cat > conftest.s <<EOF
1336 .protected foo
1337 foo:
1338 .hidden bar
1339 bar:
1341   if AC_TRY_COMMAND(${CC-cc} -c $ASFLAGS conftest.s 1>&AS_MESSAGE_LOG_FD); then
1342     libc_cv_asm_protected_directive=yes
1343   else
1344     AC_MSG_ERROR(assembler support for symbol visibility is required)
1345   fi
1346   rm -f conftest*])
1348   if test $libc_cv_asm_protected_directive = yes; then
1349     AC_CACHE_CHECK(whether __attribute__((visibility())) is supported,
1350                  libc_cv_visibility_attribute,
1351                  [cat > conftest.c <<EOF
1352                   int foo __attribute__ ((visibility ("hidden"))) = 1;
1353                   int bar __attribute__ ((visibility ("protected"))) = 1;
1355                   libc_cv_visibility_attribute=no
1356                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1357                     if grep '\.hidden.*foo' conftest.s >/dev/null; then
1358                       if grep '\.protected.*bar' conftest.s >/dev/null; then
1359                         libc_cv_visibility_attribute=yes
1360                       fi
1361                     fi
1362                   fi
1363                   rm -f conftest.[cs]
1364                  ])
1365     if test $libc_cv_visibility_attribute != yes; then
1366       AC_MSG_ERROR(compiler support for visibility attribute is required)
1367     fi
1368   fi
1370   if test $libc_cv_visibility_attribute = yes; then
1371     AC_CACHE_CHECK(for broken __attribute__((visibility())),
1372                  libc_cv_broken_visibility_attribute,
1373                  [cat > conftest.c <<EOF
1374                   int foo (int x);
1375                   int bar (int x) __asm__ ("foo") __attribute__ ((visibility ("hidden")));
1376                   int bar (int x) { return x; }
1378                   libc_cv_broken_visibility_attribute=yes
1379                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s1>&AS_MESSAGE_LOG_FD); then
1380 changequote(,)dnl
1381                     if grep '\.hidden[  _]foo' conftest.s >/dev/null; then
1382 changequote([,])dnl
1383                       libc_cv_broken_visibility_attribute=no
1384                     fi
1385                   fi
1386                   rm -f conftest.c conftest.s
1387                  ])
1388     if test $libc_cv_broken_visibility_attribute = yes; then
1389       AC_MSG_ERROR(working compiler support for visibility attribute is required)
1390     fi
1391   fi
1393   AC_CACHE_CHECK(for broken __attribute__((alias())),
1394                  libc_cv_broken_alias_attribute,
1395                  [cat > conftest.c <<EOF
1396                   extern int foo (int x) __asm ("xyzzy");
1397                   int bar (int x) { return x; }
1398                   extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
1399                   extern int dfoo;
1400                   extern __typeof (dfoo) dfoo __asm ("abccb");
1401                   int dfoo = 1;
1403                   libc_cv_broken_alias_attribute=yes
1404                   if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
1405                     if grep 'xyzzy' conftest.s >/dev/null &&
1406                        grep 'abccb' conftest.s >/dev/null; then
1407                       libc_cv_broken_alias_attribute=no
1408                     fi
1409                   fi
1410                   rm -f conftest.c conftest.s
1411                  ])
1412   if test $libc_cv_broken_alias_attribute = yes; then
1413     AC_MSG_ERROR(working alias attribute support required)
1414   fi
1416   if test $libc_cv_visibility_attribute = yes; then
1417     AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
1418                  libc_cv_have_sdata_section,
1419                  [echo "int i;" > conftest.c
1420                   libc_cv_have_sdata_section=no
1421                   if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
1422                      | grep '\.sdata' >/dev/null; then
1423                     libc_cv_have_sdata_section=yes
1424                   fi
1425                   rm -f conftest.c conftest.so
1426                  ])
1427     if test $libc_cv_have_sdata_section = yes; then
1428       AC_DEFINE(HAVE_SDATA_SECTION)
1429     fi
1430   fi
1432   AC_CACHE_CHECK(for .preinit_array/.init_array/.fini_array support,
1433                  libc_cv_initfini_array, [dnl
1434   cat > conftest.c <<EOF
1435 int _start (void) { return 0; }
1436 int __start (void) { return 0; }
1437 int foo (void) { return 1; }
1438 int (*fp) (void) __attribute__ ((section (".init_array"))) = foo;
1440   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -o conftest conftest.c
1441                      -static -nostartfiles -nostdlib 1>&AS_MESSAGE_LOG_FD])
1442   then
1443     if readelf -S conftest | fgrep INIT_ARRAY > /dev/null; then
1444       libc_cv_initfini_array=yes
1445     else
1446       libc_cv_initfini_array=no
1447     fi
1448   else
1449     libc_cv_initfini_array=no
1450   fi
1451   rm -f conftest*])
1452   if test $libc_cv_initfini_array != yes; then
1453     AC_MSG_ERROR([Need linker with .init_array/.fini_array support.])
1454   fi
1456   AC_CACHE_CHECK(for libunwind-support in compiler,
1457                  libc_cv_cc_with_libunwind, [
1458     cat > conftest.c <<EOF
1459 int main (void) { return 0; }
1461     if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
1462        conftest.c -v 2>&1 >/dev/null | grep -q " -lunwind "; then
1463       libc_cv_cc_with_libunwind=yes
1464     else
1465       libc_cv_cc_with_libunwind=no
1466     fi
1467     rm -f conftest*])
1468   AC_SUBST(libc_cv_cc_with_libunwind)
1469   if test $libc_cv_cc_with_libunwind = yes; then
1470     AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
1471   fi
1473   AC_CACHE_CHECK(for -z nodelete option,
1474                  libc_cv_z_nodelete, [dnl
1475   cat > conftest.c <<EOF
1476 int _start (void) { return 42; }
1478   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1479                      -fPIC -shared -o conftest.so conftest.c
1480                      -nostartfiles -nostdlib
1481                      -Wl,--enable-new-dtags,-z,nodelete 1>&AS_MESSAGE_LOG_FD])
1482   then
1483     libc_cv_z_nodelete=yes
1484   else
1485     AC_MSG_ERROR(linker with -z nodelete support required)
1486   fi
1487   rm -f conftest*])
1489   AC_CACHE_CHECK(for -z nodlopen option,
1490                  libc_cv_z_nodlopen, [dnl
1491   cat > conftest.c <<EOF
1492 int _start (void) { return 42; }
1494   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1495                         -fPIC -shared -o conftest.so conftest.c
1496                         -nostartfiles -nostdlib
1497                         -Wl,--enable-new-dtags,-z,nodlopen 1>&AS_MESSAGE_LOG_FD])
1498   then
1499     libc_cv_z_nodlopen=yes
1500   else
1501     AC_MSG_ERROR(linker with -z nodlopen support required)
1502   fi
1503   rm -f conftest*])
1505   AC_CACHE_CHECK(for -z initfirst option,
1506                  libc_cv_z_initfirst, [dnl
1507   cat > conftest.c <<EOF
1508 int _start (void) { return 42; }
1510   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1511                         -fPIC -shared -o conftest.so conftest.c
1512                         -nostartfiles -nostdlib
1513                         -Wl,--enable-new-dtags,-z,initfirst 1>&AS_MESSAGE_LOG_FD])
1514   then
1515     libc_cv_z_initfirst=yes
1516   else
1517     AC_MSG_ERROR(linker with -z initfirst support required)
1518   fi
1519   rm -f conftest*])
1521   case "$base_machine" in
1522 changequote(,)dnl
1523     i[34567]86 | x86_64 | powerpc* | s390* | sparc* | alpha*)
1524 changequote([,])dnl
1525       AC_CACHE_CHECK(for -z relro option,
1526                      libc_cv_z_relro, [dnl
1527   libc_cv_z_relro=no
1528   if AC_TRY_COMMAND([${CC-cc} -v --help 2>&1|grep "z relro" 1>&AS_MESSAGE_LOG_FD])
1529   then
1530     if AC_TRY_COMMAND([${CC-cc} -Wl,--verbose 2>&1|grep DATA_SEGMENT_RELRO_END 1>&AS_MESSAGE_LOG_FD])
1531     then
1532       libc_cv_z_relro=yes
1533     fi
1534   fi])
1535       if test "$libc_cv_z_relro" = no; then
1536         AC_MSG_ERROR(linker with -z relro support required)
1537       fi
1538       ;;
1539     *) ;;
1540    esac
1542   AC_CACHE_CHECK(for -Bgroup option,
1543                  libc_cv_Bgroup, [dnl
1544   cat > conftest.c <<EOF
1545 int _start (void) { return 42; }
1547   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1548                               -fPIC -shared -o conftest.so conftest.c
1549                               -Wl,-Bgroup -nostdlib 1>&AS_MESSAGE_LOG_FD])
1550   then
1551     libc_cv_Bgroup=yes
1552   else
1553     libc_cv_Bgroup=no
1554   fi
1555   rm -f conftest*])
1556   AC_SUBST(libc_cv_Bgroup)
1558   AC_CACHE_CHECK(for libgcc_s suffix,
1559                  libc_cv_libgcc_s_suffix, [dnl
1560   cat > conftest.c <<EOF
1561 int main (void) { return 0; }
1563 changequote(,)dnl
1564   libc_cv_libgcc_s_suffix=`${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
1565                            -fPIC -shared -shared-libgcc -o conftest.so \
1566                            conftest.c -v 2>&1 >/dev/null \
1567                            | sed -n 's/^.* -lgcc_s\([^ ]*\) .*$/\1/p'`
1568 changequote([,])dnl
1569   rm -f conftest*])
1570   AC_SUBST(libc_cv_libgcc_s_suffix)
1572   AC_CACHE_CHECK(for --as-needed option,
1573                  libc_cv_as_needed, [dnl
1574   cat > conftest.c <<EOF
1575 int main (void) { return 0; }
1577   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1578                               -fPIC -shared -o conftest.so conftest.c
1579                               -lgcc_s$libc_cv_libgcc_s_suffix -Wl,--as-needed
1580                               -nostdlib 1>&AS_MESSAGE_LOG_FD])
1581   then
1582     libc_cv_as_needed=yes
1583   else
1584     libc_cv_as_needed=no
1585   fi
1586   rm -f conftest*])
1587   AC_SUBST(libc_cv_as_needed)
1589   ASFLAGS_config=
1590   AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
1591                  libc_cv_as_noexecstack, [dnl
1592   cat > conftest.c <<EOF
1593 void foo (void) { }
1595   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
1596                      -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
1597      && grep -q .note.GNU-stack conftest.s \
1598      && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
1599                        -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
1600   then
1601     libc_cv_as_noexecstack=yes
1602   else
1603     libc_cv_as_noexecstack=no
1604   fi
1605   rm -f conftest*])
1606   if test $libc_cv_as_noexecstack = yes; then
1607     ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
1608   fi
1609   AC_SUBST(ASFLAGS_config)
1611   AC_CACHE_CHECK(for -z combreloc,
1612                  libc_cv_z_combreloc, [dnl
1613   cat > conftest.c <<EOF
1614 extern int bar (int);
1615 extern int mumble;
1616 int foo (void) { return bar (mumble); }
1618   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1619                         -fPIC -shared -o conftest.so conftest.c
1620                         -nostdlib -nostartfiles
1621                         -Wl,-z,combreloc 1>&AS_MESSAGE_LOG_FD])
1622   then
1623 dnl The following test is a bit weak.  We must use a tool which can test
1624 dnl cross-platform since the gcc used can be a cross compiler.  Without
1625 dnl introducing new options this is not easily doable.  Instead use a tool
1626 dnl which always is cross-platform: readelf.  To detect whether -z combreloc
1627 dnl look for a section named .rel.dyn.
1628     if readelf -S conftest.so | grep '\.rel\(a\|\)\.dyn' > /dev/null; then
1629       libc_cv_z_combreloc=yes
1630     else
1631       libc_cv_z_combreloc=no
1632     fi
1633   else
1634     libc_cv_z_combreloc=no
1635   fi
1636   rm -f conftest*])
1637   if test "$libc_cv_z_combreloc" = yes; then
1638     AC_DEFINE(HAVE_Z_COMBRELOC)
1639   fi
1640   AC_SUBST(libc_cv_z_combreloc)
1642   AC_CACHE_CHECK(for -z execstack,
1643                  libc_cv_z_execstack, [dnl
1644   cat > conftest.c <<EOF
1645 int _start (void) { return 42; }
1647   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1648                               -fPIC -shared -o conftest.so conftest.c
1649                               -Wl,-z,execstack -nostdlib
1650                               1>&AS_MESSAGE_LOG_FD])
1651   then
1652     libc_cv_z_execstack=yes
1653   else
1654     libc_cv_z_execstack=no
1655   fi
1656   rm -f conftest*])
1657   AC_SUBST(libc_cv_z_execstack)
1659   AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
1660   cat > conftest.c <<EOF
1661 int foo;
1662 main () { return 0;}
1664   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -pie -fpie
1665                               -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1666   then
1667     libc_cv_fpie=yes
1668   else
1669     libc_cv_fpie=no
1670   fi
1671   rm -f conftest*])
1673   AC_SUBST(libc_cv_fpie)
1675   AC_CACHE_CHECK(for --hash-style option,
1676                  libc_cv_hashstyle, [dnl
1677   cat > conftest.c <<EOF
1678 int _start (void) { return 42; }
1680   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1681                               -fPIC -shared -o conftest.so conftest.c
1682                               -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
1683   then
1684     libc_cv_hashstyle=yes
1685   else
1686     libc_cv_hashstyle=no
1687   fi
1688   rm -f conftest*])
1689   AC_SUBST(libc_cv_hashstyle)
1692 AC_CACHE_CHECK(for -fno-toplevel-reorder -fno-section-anchors, libc_cv_fno_toplevel_reorder, [dnl
1693 cat > conftest.c <<EOF
1694 int foo;
1696 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -fno-toplevel-reorder -fno-section-anchors
1697                             conftest.c 1>&AS_MESSAGE_LOG_FD])
1698 then
1699   libc_cv_fno_toplevel_reorder=yes
1700 else
1701   libc_cv_fno_toplevel_reorder=no
1703 rm -f conftest*])
1704 if test $libc_cv_fno_toplevel_reorder = yes; then
1705   fno_unit_at_a_time="-fno-toplevel-reorder -fno-section-anchors"
1706 else
1707   fno_unit_at_a_time=-fno-unit-at-a-time
1709 AC_SUBST(fno_unit_at_a_time)
1711 AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
1712 cat > conftest.c <<EOF
1713 int foo;
1714 main () { return 0;}
1716 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -Werror -fstack-protector
1717                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD])
1718 then
1719   libc_cv_ssp=yes
1720 else
1721   libc_cv_ssp=no
1723 rm -f conftest*])
1724 AC_SUBST(libc_cv_ssp)
1726 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
1727 cat > conftest.c <<EOF
1728 int foo;
1729 #ifdef __GNUC_GNU_INLINE__
1730 main () { return 0;}
1731 #else
1732 #error
1733 #endif
1735 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -std=gnu99 -fgnu89-inline
1736                             -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD])
1737 then
1738   libc_cv_gnu89_inline=yes
1739 else
1740   libc_cv_gnu89_inline=no
1742 rm -f conftest*])
1743 if test $libc_cv_gnu89_inline = yes; then
1744   libc_cv_gnu89_inline=-fgnu89-inline
1745 else
1746   libc_cv_gnu89_inline=
1748 AC_SUBST(libc_cv_gnu89_inline)
1750 if test $elf != yes; then
1751   AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
1752                  [AC_TRY_COMPILE(, [asm (".section .init");
1753                                     asm (".section .fini");
1754                                     asm ("${libc_cv_dot_text}");],
1755                                  libc_cv_have_initfini=yes,
1756                                  libc_cv_have_initfini=no)])
1757   AC_SUBST(libc_cv_have_initfini)dnl
1758   if test $libc_cv_have_initfini = yes; then
1759     AC_DEFINE(HAVE_INITFINI)
1760   fi
1763 if test $elf = yes; then
1764   AC_CACHE_CHECK(whether cc puts quotes around section names,
1765                  libc_cv_have_section_quotes,
1766                  [cat > conftest.c <<EOF
1767                   static const int foo
1768                   __attribute__ ((section ("bar"))) = 1;
1770                   if ${CC-cc} -S conftest.c -o conftest.s; then
1771                     if grep '\.section.*"bar"' conftest.s >/dev/null; then
1772                       libc_cv_have_section_quotes=yes
1773                     else
1774                       libc_cv_have_section_quotes=no
1775                     fi
1776                   else
1777                     libc_cv_have_section_quotes=unknown
1778                   fi
1779                   rm -f conftest.[cs]
1780                  ])
1781   if test $libc_cv_have_section_quotes = yes; then
1782     AC_DEFINE(HAVE_SECTION_QUOTES)
1783   fi
1786 dnl AC_CHECK_ASM_UNDERSCORE([ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
1787 AC_DEFUN(AC_CHECK_ASM_UNDERSCORE,
1788 [cat > conftest.$ac_ext <<EOF
1789 dnl This sometimes fails to find confdefs.h, for some reason.
1790 dnl [#]line $LINENO "[$]0"
1791 [#]line $LINENO "configure"
1792 #include "confdefs.h"
1793 void underscore_test(void) {
1794 return; }
1796 if AC_TRY_EVAL(ac_compile); then
1797   if grep _underscore_test conftest* >/dev/null; then
1798     ifelse([$1], , :, [rm -f conftest*
1799     $1])
1800   else
1801     ifelse([$2], , , [rm -f conftest*
1802     $2])
1803   fi
1804 else
1805   echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD
1806   cat conftest.$ac_ext >&AS_MESSAGE_LOG_FD
1807   ifelse([$2], , , [rm -f conftest*
1808   $2])
1810 rm -f conftest*])
1812 if test $elf = yes; then
1813   libc_cv_asm_underscores=no
1814 else
1815   if test $ac_cv_prog_cc_works = yes; then
1816     AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1817                    [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
1818                                 libc_cv_asm_underscores=yes,
1819                                 libc_cv_asm_underscores=no)])
1820   else
1821     AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
1822                    [AC_CHECK_ASM_UNDERSCORE(libc_cv_asm_underscores=yes,
1823                                             libc_cv_asm_underscores=no)])
1824   fi
1826 if test $libc_cv_asm_underscores = no; then
1827   AC_DEFINE(NO_UNDERSCORES)
1830 if test $elf = yes; then
1831   libc_cv_weak_symbols=yes
1834 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
1835                [dnl
1836 cat > conftest.s <<EOF
1837 ${libc_cv_dot_text}
1838 ${libc_cv_asm_global_directive} foo
1839 foo:
1840 .weak foo
1841 .weak bar; bar = foo
1843 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1844   libc_cv_asm_weak_directive=yes
1845 else
1846   libc_cv_asm_weak_directive=no
1848 rm -f conftest*])
1850 if test $libc_cv_asm_weak_directive = no; then
1851   AC_CACHE_CHECK(for assembler .weakext directive,
1852                  libc_cv_asm_weakext_directive,
1853                  [dnl
1854 cat > conftest.s <<EOF
1855 ${libc_cv_dot_text}
1856 ${libc_cv_asm_global_directive} foo
1857 foo:
1858 .weakext bar foo
1859 .weakext baz
1860 ${libc_cv_asm_global_directive} baz
1861 baz:
1863   if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1864     libc_cv_asm_weakext_directive=yes
1865   else
1866     libc_cv_asm_weakext_directive=no
1867   fi
1868   rm -f conftest*])
1870 fi # no .weak
1872 if test $libc_cv_asm_weak_directive = yes; then
1873   AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
1874 elif test $libc_cv_asm_weakext_directive = yes; then
1875   AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
1878 AC_CACHE_CHECK(whether CFI directives are supported, libc_cv_asm_cfi_directives, [dnl
1879 case $machine in
1880   sparc/sparc64*) cfi_offset=2047;;
1881   *) cfi_offset=0;;
1882 esac
1883 cat > conftest.s <<EOF
1884         .text
1885         .type   func,%function
1886 func:
1887         .cfi_startproc
1888         .cfi_remember_state
1889         .cfi_rel_offset 1, $cfi_offset
1890         .cfi_endproc
1892 if AC_TRY_COMMAND(${CC-cc} $ASFLAGS -c conftest.s 1>&AS_MESSAGE_LOG_FD); then
1893   libc_cv_asm_cfi_directives=yes
1894 else
1895   libc_cv_asm_cfi_directives=no
1897 rm -f conftest*])
1898 if test $libc_cv_asm_cfi_directives = yes; then
1899   AC_DEFINE(HAVE_ASM_CFI_DIRECTIVES)
1902 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
1903 cat > conftest.c <<\EOF
1904 _start () {}
1905 int __eh_pc;
1906 __throw () {}
1908 dnl No \ in command here because it ends up inside ''.
1909 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1910                             -nostdlib -nostartfiles -Wl,--no-whole-archive
1911                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1912   libc_cv_ld_no_whole_archive=yes
1913 else
1914   libc_cv_ld_no_whole_archive=no
1916 rm -f conftest*])
1917 if test $libc_cv_ld_no_whole_archive = yes; then
1918   no_whole_archive=-Wl,--no-whole-archive
1920 AC_SUBST(no_whole_archive)dnl
1922 AC_CACHE_CHECK(for gcc -fexceptions, libc_cv_gcc_exceptions, [dnl
1923 cat > conftest.c <<\EOF
1924 _start () {}
1925 int __eh_pc;
1926 __throw () {}
1928 dnl No \ in command here because it ends up inside ''.
1929 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
1930                             -nostdlib -nostartfiles -fexceptions
1931                             -o conftest conftest.c 1>&AS_MESSAGE_LOG_FD]); then
1932   libc_cv_gcc_exceptions=yes
1933 else
1934   libc_cv_gcc_exceptions=no
1936 rm -f conftest*])
1937 if test $libc_cv_gcc_exceptions = yes; then
1938   exceptions=-fexceptions
1940 AC_SUBST(exceptions)dnl
1942 if test "$host_cpu" = powerpc ; then
1943 # Check for a bug present in at least versions 2.8.x of GCC
1944 # and versions 1.0.x of EGCS.
1945 AC_CACHE_CHECK(whether clobbering cr0 causes problems,libc_cv_c_asmcr0_bug,[dnl
1946 AC_TRY_COMPILE([int tester(int x) { asm ("" : : : "cc"); return x & 123; }],,
1947                libc_cv_c_asmcr0_bug='no',
1948                libc_cv_c_asmcr0_bug='yes')])
1949 if test "$libc_cv_c_asmcr0_bug" != 'no'; then
1950   AC_DEFINE(BROKEN_PPC_ASM_CR0)
1954 dnl Check whether compiler understands __builtin_expect.
1955 AC_CACHE_CHECK(for __builtin_expect, libc_cv_gcc_builtin_expect,
1956 [cat > conftest.c <<EOF
1957 #line $LINENO "configure"
1958 int foo (int a)
1960   a = __builtin_expect (a, 10);
1961   return a == 10 ? 0 : 1;
1964 dnl No \ in command here because it ends up inside ''.
1965 if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostdlib -nostartfiles
1966                             -o conftest conftest.c -lgcc >&AS_MESSAGE_LOG_FD]); then
1967   libc_cv_gcc_builtin_expect=yes
1968 else
1969   libc_cv_gcc_builtin_expect=no
1971 rm -f conftest*])
1972 if test "$libc_cv_gcc_builtin_expect" = yes; then
1973   AC_DEFINE(HAVE_BUILTIN_EXPECT)
1976 AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
1977 cat > conftest.c <<\EOF
1978 void zero (void *x)
1980   __builtin_memset (x, 0, 1000);
1984 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "memset" > /dev/null]);
1985 then
1986   libc_cv_gcc_builtin_memset=no
1987 else
1988   libc_cv_gcc_builtin_memset=yes
1990 rm -f conftest* ])
1991 if test "$libc_cv_gcc_builtin_memset" = yes ; then
1992   AC_DEFINE(HAVE_BUILTIN_MEMSET)
1995 AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
1996 cat > conftest.c <<\EOF
1997 extern char *strstr (const char *, const char *) __asm ("my_strstr");
1998 char *foo (const char *a, const char *b)
2000   return __builtin_strstr (a, b);
2004 if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | fgrep "my_strstr" > /dev/null]);
2005 then
2006   libc_cv_gcc_builtin_redirection=yes
2007 else
2008   libc_cv_gcc_builtin_redirection=no
2010 rm -f conftest* ])
2011 if test "$libc_cv_gcc_builtin_redirection" = yes ; then
2012   AC_DEFINE(HAVE_BUILTIN_REDIRECTION)
2015 dnl Check whether the compiler supports the __thread keyword.
2016 if test "x$use__thread" != xno; then
2017   AC_CACHE_CHECK([for __thread], libc_cv_gcc___thread,
2018   [cat > conftest.c <<\EOF
2019 __thread int a = 42;
2021   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c >&AS_MESSAGE_LOG_FD]); then
2022     libc_cv_gcc___thread=yes
2023   else
2024     libc_cv_gcc___thread=no
2025   fi
2026   rm -f conftest*])
2027   if test "$libc_cv_gcc___thread" = yes; then
2028     AC_DEFINE(HAVE___THREAD)
2029   fi
2030 else
2031   libc_cv_gcc___thread=no
2034 if test "$libc_cv_gcc___thread" = yes; then
2035   dnl Check whether the compiler supports the tls_model attribute.
2036   AC_CACHE_CHECK([for tls_model attribute], libc_cv_gcc_tls_model_attr, [dnl
2037   cat > conftest.c <<\EOF
2038 extern __thread int a __attribute__((tls_model ("initial-exec")));
2040   if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -S -Werror conftest.c >&AS_MESSAGE_LOG_FD]); then
2041     libc_cv_gcc_tls_model_attr=yes
2042   else
2043     libc_cv_gcc_tls_model_attr=no
2044   fi
2045   rm -f conftest*])
2046   if test "$libc_cv_gcc_tls_model_attr" = yes; then
2047     AC_DEFINE(HAVE_TLS_MODEL_ATTRIBUTE)
2048   fi
2051 if test -n "$submachine"; then
2052   AC_CACHE_CHECK([for compiler option for CPU variant],
2053                  libc_cv_cc_submachine, [dnl
2054   libc_cv_cc_submachine=no
2055   for opt in "-march=$submachine" "-mcpu=$submachine"; do
2056     if AC_TRY_COMMAND([${CC-cc} $opt -xc /dev/null -S -o /dev/null]); then
2057       libc_cv_cc_submachine="$opt"
2058       break
2059     fi
2060   done])
2061   if test "x$libc_cv_cc_submachine" = xno; then
2062     AC_MSG_ERROR([${CC-cc} does not support $submachine])
2063   fi
2065 AC_SUBST(libc_cv_cc_submachine)
2067 dnl Check whether we have the gd library available.
2068 AC_MSG_CHECKING(for libgd)
2069 if test "$with_gd" != "no"; then
2070   old_CFLAGS="$CFLAGS"
2071   CFLAGS="$CFLAGS $libgd_include"
2072   old_LDFLAGS="$LDFLAGS"
2073   LDFLAGS="$LDFLAGS $libgd_ldflags"
2074   old_LIBS="$LIBS"
2075   LIBS="$LIBS -lgd -lpng -lz -lm"
2076   AC_TRY_LINK([#include <gd.h>], [gdImagePng (0, 0)], LIBGD=yes, LIBGD=no)
2077   CFLAGS="$old_CFLAGS"
2078   LDFLAGS="$old_LDFLAGS"
2079   LIBS="$old_LIBS"
2080 else
2081   LIBGD=no
2083 AC_MSG_RESULT($LIBGD)
2084 AC_SUBST(LIBGD)
2086 # SELinux detection
2087 if test x$with_selinux = xno ; then
2088   have_selinux=no;
2089 else
2090   # See if we have the SELinux library
2091   AC_CHECK_LIB(selinux, is_selinux_enabled,
2092                have_selinux=yes, have_selinux=no)
2093   # See if we have the SELinux header with the NSCD permissions in it.
2094   if test x$have_selinux = xyes ; then
2095     AC_MSG_CHECKING([for NSCD Flask permissions in selinux/av_permissions.h])
2096     AC_TRY_COMPILE([#include <selinux/av_permissions.h>],
2097                     [#ifdef NSCD__SHMEMHOST
2098                      return 0;
2099                      #else
2100                      #error NSCD__SHMEMHOST not defined
2101                      #endif],
2102                     have_selinux=yes, have_selinux=no)
2103     AC_MSG_RESULT($have_selinux)
2104   fi
2106   if test x$with_selinux = xyes ; then
2107     if test x$have_selinux = xno ; then
2108       AC_MSG_ERROR([SELinux explicitly required, but sufficiently recent SELinux library not found])
2109     fi
2110   fi
2112 # Check if we're building with SELinux support.
2113 if test "x$have_selinux" = xyes; then
2114   AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
2116   # See if we have the libaudit library
2117   AC_CHECK_LIB(audit, audit_log_user_avc_message,
2118                have_libaudit=yes, have_libaudit=no)
2119   if test "x$have_libaudit" = xyes; then
2120     AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
2121   fi
2122   AC_SUBST(have_libaudit)
2124   # See if we have the libcap library
2125   AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
2126   if test "x$have_libcap" = xyes; then
2127     AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
2128   fi
2129   AC_SUBST(have_libcap)
2131 AC_SUBST(have_selinux)
2133 dnl check for the size of 'long double'.
2134 AC_CHECK_SIZEOF(long double, 0)
2135 sizeof_long_double=$ac_cv_sizeof_long_double
2136 AC_SUBST(sizeof_long_double)
2138 ### End of automated tests.
2139 ### Now run sysdeps configure fragments.
2141 # They also can set these variables.
2142 use_ldconfig=no
2143 ldd_rewrite_script=no
2144 libc_cv_sysconfdir=$sysconfdir
2145 libc_cv_gcc_unwind_find_fde=no
2146 libc_cv_idn=no
2148 # Iterate over all the sysdep directories we will use, running their
2149 # configure fragments, and looking for a uname implementation.
2150 uname=
2151 for dir in $sysnames; do
2152   case $dir in
2153     /*) dest=$dir ;;
2154     *)  dest=$srcdir/$dir ;;
2155   esac
2156   if test -r $dest/configure; then
2157     AC_MSG_RESULT(running configure fragment for $dir)
2158     . $dest/configure
2159   fi
2161   if test -z "$uname"; then
2162     if test -r $dest/uname.c ||
2163        test -r $dest/uname.S ||
2164        { test -r $dest/syscalls.list &&
2165          grep '^uname[  ]' $dest/syscalls.list >/dev/null; }; then
2166       uname=$dir
2167     fi
2168   fi
2169 ]dnl
2170 done
2172 if test x$libc_cv_gcc_unwind_find_fde = xyes; then
2173   AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
2175 AC_SUBST(libc_cv_gcc_unwind_find_fde)
2177 # If we will use the generic uname implementation, we must figure out what
2178 # it will say by examining the system, and write the results in config-name.h.
2179 if test "$uname" = "sysdeps/generic"; then
2181 changequote(,)dnl
2182   uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
2183 changequote([,])dnl
2184   if test $uname_sysname != $config_os; then
2185     config_release=`echo $config_os | sed s/$uname_sysname//`
2186   fi
2188 AC_DEFUN(LIBC_KERNEL_ID, [dnl
2189     if test -r /vmunix; then
2190       kernel_id=`strings /vmunix | grep UNIX`
2191     elif test -r /dynix; then
2192       kernel_id=`strings /dynix | grep DYNIX`
2193     else
2194       kernel_id=
2195     fi
2196 ])dnl
2198   AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
2199 LIBC_KERNEL_ID
2200 changequote(,)dnl
2201   kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
2202 changequote([,])dnl
2203   if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
2204          != x$config_release; then
2205     # The configuration release is a substring of the kernel release.
2206     libc_cv_uname_release=$kernel_release
2207   elif test x$config_release != x; then
2208     libc_cv_uname_release=$config_release
2209   elif test x$kernel_release != x; then
2210     libc_cv_uname_release=$kernel_release
2211   else
2212     libc_cv_uname_release=unknown
2213   fi])
2214   uname_release="$libc_cv_uname_release"
2216   AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
2217 LIBC_KERNEL_ID
2218 changequote(,)dnl
2219   kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
2220 changequote([,])dnl
2221   if test -n "$kernel_version"; then
2222     libc_cv_uname_version="$kernel_version"
2223   else
2224     libc_cv_uname_version=unknown
2225   fi])
2226   uname_version="$libc_cv_uname_version"
2228 AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
2229   config_uname=config-name.h:config-name.in
2230 else
2231   # For non-generic uname, we don't need to create config-name.h at all.
2232   config_uname=
2235 dnl This is tested by existing code and it's simpler to avoid changing it.
2236 AC_DEFINE(USE_IN_LIBIO)
2238 # Test for old glibc 2.0.x headers so that they can be removed properly
2239 # Search only in includedir.
2240 AC_MSG_CHECKING(for old glibc 2.0.x headers)
2241 if eval test -f "${includedir}/elfclass.h" -a -f "${includedir}/fcntlbits.h"
2242 then
2243   old_glibc_headers=yes
2244 else
2245   old_glibc_headers=no
2247 AC_MSG_RESULT($old_glibc_headers)
2248 if test ${old_glibc_headers} = yes; then
2249   AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
2250   AC_MSG_WARN(*** be removed.)
2252 AC_SUBST(old_glibc_headers)
2254 AC_SUBST(libc_cv_slibdir)
2255 AC_SUBST(libc_cv_localedir)
2256 AC_SUBST(libc_cv_sysconfdir)
2257 AC_SUBST(libc_cv_rootsbindir)
2258 AC_SUBST(libc_cv_forced_unwind)
2260 dnl sysdeps/CPU/configure.in checks set this via arch-specific asm tests
2261 AC_SUBST(libc_cv_cpp_asm_debuginfo)
2263 AC_SUBST(use_ldconfig)
2264 AC_SUBST(ldd_rewrite_script)
2266 AC_SUBST(elf) AC_SUBST(xcoff)
2267 if test $elf = yes; then
2268   AC_DEFINE(HAVE_ELF)
2270 if test $xcoff = yes; then
2271   AC_DEFINE(HAVE_XCOFF)
2274 AC_SUBST(static)
2275 AC_SUBST(shared)
2276 if test $shared = default; then
2277   shared=$elf
2280 AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
2281 [libc_cv_pic_default=yes
2282 cat > conftest.c <<EOF
2283 #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
2284 # error PIC is default.
2285 #endif
2287 if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
2288   libc_cv_pic_default=no
2290 rm -f conftest.*])
2291 AC_SUBST(libc_cv_pic_default)
2293 AC_SUBST(profile)
2294 AC_SUBST(omitfp)
2295 AC_SUBST(bounded)
2296 AC_SUBST(static_nss)
2297 AC_SUBST(nopic_initfini)
2299 AC_SUBST(DEFINES)
2301 dnl See sysdeps/mach/configure.in for this variable.
2302 AC_SUBST(mach_interface_list)
2304 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
2305   config_makefile=
2306 else
2307   config_makefile=Makefile
2310 VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
2311 RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
2312 AC_SUBST(VERSION)
2313 AC_SUBST(RELEASE)
2315 AC_CONFIG_FILES([config.make ${config_makefile} ${config_uname}])
2316 AC_CONFIG_COMMANDS([default],[[
2317 case $CONFIG_FILES in *config.make*)
2318 echo "$config_vars" >> config.make;;
2319 esac
2320 test -d bits || mkdir bits]],[[config_vars='$config_vars']])
2321 AC_OUTPUT