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