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