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