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