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