Updated.
[jlayton/glibc.git] / configure.in
1 Dnl Process this file with autoconf to produce a configure script.
2 AC_REVISION([$CVSid$])
3 AC_PREREQ(2.11)dnl              dnl Minimum Autoconf version required.
4 AC_INIT(include/features.h)
5 AC_CONFIG_HEADER(config.h)
6
7 # This will get text that should go into config.make.
8 config_vars=
9
10 # Check for a --with-gmp argument and set gmp-srcdir in config.make.
11 AC_ARG_WITH(gmp, dnl
12   --with-gmp=DIRECTORY    find GMP source code in DIRECTORY (not needed),
13             [dnl
14 case "$with_gmp" in
15 yes) AC_MSG_ERROR(--with-gmp requires an argument; use --with-gmp=DIRECTORY) ;;
16 ''|no) ;;
17 *) config_vars="$config_vars
18 gmp-srcdir = $withval" ;;
19 esac
20 ])
21 # Check for a --with-gettext argument and set gettext-srcdir in config.make.
22 AC_ARG_WITH(gettext, dnl
23   --with-gettext=DIR      find GNU gettext source code in DIR (not needed),
24             [dnl
25 case "$with_gettext" in
26 yes)
27   AC_MSG_ERROR(--with-gettext requires an argument; use --with-gettext=DIR) ;;
28 ''|no) ;;
29 *)
30   config_vars="$config_vars
31 gettext-srcdir = $withval" ;;
32 esac
33 ])
34
35 dnl Arguments to specify presence of other packages/features.
36 AC_ARG_WITH(fp, dnl
37 [  --with-fp              if using floating-point hardware [default=yes]],
38             with_fp=$withval, with_fp=yes)
39 AC_ARG_WITH(gnu-binutils, dnl
40   --with-gnu-binutils     if using GNU binutils (as and ld),
41             gnu_binutils=$withval, gnu_binutils=no)
42 AC_ARG_WITH(gnu-ld, dnl
43   --with-gnu-ld           if using GNU ld (in the binutils package),
44             gnu_ld=$withval, gnu_ld=no)
45 AC_ARG_WITH(gnu-as, dnl
46   --with-gnu-as           if using GNU as (in the binutils package),
47             gnu_as=$withval, gnu_as=no)
48 test $gnu_binutils = yes && gnu_as=yes gnu_ld=yes
49 AC_ARG_WITH(elf, dnl
50   --with-elf              if using the ELF object format,
51             elf=$withval, elf=no)
52
53 AC_ARG_ENABLE(libio, dnl
54 [  --enable-libio          build in GNU libio instead of GNU stdio],
55               [if test $enableval = yes; then
56                  stdio=libio
57                else
58                  stdio=stdio
59                fi],
60               stdio=default)
61
62 AC_ARG_ENABLE(sanity-checks, dnl
63 [  --disable-sanity-checks really do not use threads (should not be used
64                           except in special situations) [default=yes]],
65               enable_sanity=$enableval, enable_sanity=yes)
66
67 dnl Arguments to enable or disable building the shared, profiled, and
68 dnl -fomit-frame-pointer libraries.
69 AC_ARG_ENABLE(shared, dnl
70 [  --enable-shared         build shared library [default=yes if GNU ld & ELF]],
71               shared=$enableval, shared=default)
72 AC_ARG_ENABLE(profile, dnl
73 [  --enable-profile        build profiled library [default=yes]],
74               profile=$enableval, profile=yes)
75 AC_ARG_ENABLE(omitfp, dnl
76 [  --enable-omitfp         build undebuggable optimized library [default=no]],
77               omitfp=$enableval, omitfp=no)
78 AC_ARG_ENABLE(bounded, dnl
79 [  --enable-bounded        build with runtime bounds checking [default=no]],
80               bounded=$enableval, bounded=no)
81
82 dnl Generic infrastructure for drop-in additions to libc.
83 AC_ARG_ENABLE(add-ons, dnl
84 [  --enable-add-ons=DIR... configure and build named extra directories],
85               [add_ons=`echo "$enableval" | sed 's/,/ /g'`],
86               [add_ons=])
87 AC_CONFIG_SUBDIRS($add_ons)
88 add_ons_pfx=
89 if test x"$add_ons" != x; then
90   for f in $add_ons; do
91     add_ons_pfx="$add_ons_pfx $f/"
92   done
93 fi
94
95 dnl On some platforms we cannot use dynamic loading.  We must provide
96 dnl static NSS modules.
97 AC_ARG_ENABLE(static-nss, dnl
98 [  --enable-static-nss     build static NSS modules [default=no]],
99               static_nss=$enableval, static_nss=no)
100 if test x"$static_nss" = xyes; then
101   AC_DEFINE(DO_STATIC_NSS)
102 fi
103
104 AC_CANONICAL_HOST
105
106 # The way shlib-versions is used to generate soversions.mk uses a
107 # fairly simplistic model for name recognition that can't distinguish
108 # i486-pc-linux-gnu fully from i486-pc-gnu.  So we mutate a $host_os
109 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
110 # tell.  This doesn't get used much beyond that, so it's fairly safe.
111 case "$host_os" in
112 linux*)
113   ;;
114 gnu*)
115   host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
116   ;;
117 esac
118
119 # We keep the original values in `$config_*' and never modify them, so we
120 # can write them unchanged into config.make.  Everything else uses
121 # $machine, $vendor, and $os, and changes them whenever convenient.
122 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
123
124 # Some configurations imply other options.
125 case "$host_os" in
126 gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
127   # These systems always use GNU tools.
128   gnu_ld=yes gnu_as=yes ;;
129 esac
130 case "$host_os" in
131 # i586-linuxaout is mangled into i586-pc-linux-gnuaout
132 linux*ecoff* | linux*aout* | gnu*aout* | gnu*ecoff*)
133   ;;
134 gnu* | linux* | sysv4* | solaris2*)
135   # These systems (almost) always use the ELF format.
136   elf=yes
137   ;;
138 esac
139
140 machine=$config_machine
141 vendor=$config_vendor
142 os=$config_os
143
144 dnl We need to use [ and ] for other purposes for a while now.
145 changequote(,)dnl
146 # Expand the configuration machine name into a subdirectory by architecture
147 # type and particular chip.
148 case "$machine" in
149 a29k | am29000) base_machine=a29k machine=a29k ;;
150 alpha*)         base_machine=alpha machine=alpha/$machine ;;
151 arm*)           base_machine=arm machine=arm/$machine ;;
152 hppa*)          base_machine=hppa machine=hppa/$machine ;;
153 i[3456]86)      base_machine=i386 machine=i386/$machine ;;
154 m680?0)         base_machine=m68k machine=m68k/$machine ;;
155 m68k)           base_machine=m68k machine=m68k/m68020 ;;
156 m88???)         base_machine=m88k machine=m88k/$machine ;;
157 m88k)           base_machine=m88k machine=m88k/m88100 ;;
158 mips*)          base_machine=mips machine=mips/$machine ;;
159 mips64*)        base_machine=mips64 machine=mips/mips64/$machine ;;
160 sparc[6789])    base_machine=sparc machine=sparc/$machine ;;
161 supersparc)     base_machine=sparc machine=sparc/sparc8 ;;
162 esac
163 changequote([,])dnl
164 AC_SUBST(base_machine)
165
166 # Compute the list of sysdep directories for this configuration.
167 # This can take a while to compute.
168 sysdep_dir=$srcdir/sysdeps
169 AC_MSG_CHECKING(sysdep dirs)
170 dnl We need to use [ and ] for other purposes for a while now.
171 changequote(,)dnl
172 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
173 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
174
175 case "$os" in
176 gnu*)
177   base_os=mach/hurd ;;
178 netbsd* | 386bsd* | freebsd* | bsdi*)
179   base_os=unix/bsd/bsd4.4 ;;
180 osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
181   base_os=unix/bsd ;;
182 sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
183   base_os=unix/sysv ;;
184 solaris[2-9]*)
185   base_os=unix/sysv/sysv4 ;;
186 none)
187   base_os=standalone ;;
188 *)
189   base_os='' ;;
190 esac
191
192 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
193 tail=$os
194 ostry=$os
195 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
196   ostry="$ostry /$o"
197   tail=$o
198 done
199 o=`echo $tail | sed 's/[0-9]*$//'`
200 if test $o != $tail; then
201   ostry="$ostry /$o"
202 fi
203 # For linux-gnu, try linux-gnu, then linux.
204 o=`echo $tail | sed 's/-.*$//'`
205 if test $o != $tail; then
206   ostry="$ostry /$o"
207 fi
208
209 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
210 base=
211 tail=$base_os
212 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
213   set $b
214   base="$base /$1"
215   tail="$2"
216 done
217
218 # For sparc/sparc9, try sparc/sparc9 and then sparc.
219 mach=
220 tail=$machine
221 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
222   set $m
223   # Prepend the machine's FPU directory unless --without-fp.
224   if test "$with_fp" = yes; then
225     mach="$mach /$1/fpu"
226   fi
227   mach="$mach /$1"
228   tail="$2"
229 done
230
231 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
232 changequote([,])dnl
233
234 # Find what sysdep directories exist.
235 sysnames=
236 IFS="${IFS=     }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
237 for d in $add_ons_pfx ''; do
238   for b in $base ''; do
239     for m0 in $mach ''; do
240       for v in /$vendor ''; do
241         for o in /$ostry ''; do
242           for m in $mach ''; do
243             if test "$m0$b$v$o$m"; then
244               try="${d}sysdeps$m0$b$v$o$m"
245               test -n "$enable_debug_configure" &&
246               echo "$0 [DEBUG]: try $try" >&2
247               case $try in
248                 /*) dest=$try ;;
249                 *)  dest=$srcdir/$try ;;
250               esac
251               if test -d $dest; then
252                 sysnames="$sysnames $try"
253                 { test -n "$o" || test -n "$b"; } && os_used=t
254                 { test -n "$m" || test -n "$m0"; } && machine_used=t
255               fi
256             fi
257           done
258         done
259       done
260     done
261   done
262 done
263 IFS="$ac_save_ifs"
264
265 if test -z "$os_used" && test "$os" != none; then
266   AC_MSG_ERROR(Operating system $os is not supported.)
267 fi
268 if test -z "$machine_used" && test "$machine" != none; then
269   AC_MSG_ERROR(The $machine is not supported.)
270 fi
271
272 # We have now validated the configuration.
273
274
275 # If using ELF, look for an `elf' subdirectory of each machine directory.
276 # We prepend these rather than inserting them whereever the machine appears
277 # because things specified by the machine's ELF ABI should override
278 # OS-specific things, and should always be the same for any OS on the
279 # machine (otherwise what's the point of an ABI?).
280 if test "$elf" = yes; then
281   elf_dirs=
282   for d in $add_ons_pfx ''; do
283     case $d in
284       /*) xsrcdir= ;;
285       *)  xsrcdir=$srcdir/ ;;
286     esac
287     for m in $mach; do
288       if test -d $xsrcdir${d}sysdeps$m/elf; then
289         elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
290       fi
291     done
292   done
293   sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
294 fi
295
296
297 # Expand the list of system names into a full list of directories
298 # from each element's parent name and Implies file (if present).
299 set $sysnames
300 names=
301 while test $# -gt 0; do
302   name=$1
303   shift
304
305   case " $names " in *" $name "*)
306     # Already in the list.
307     continue
308   esac
309
310   # Report each name as we discover it, so there is no long pause in output.
311   echo $ac_n "$name $ac_c" >&AC_FD_MSG
312
313   name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
314
315   case $name in
316     /*) xsrcdir= ;;
317     *)  xsrcdir=$srcdir/ ;;
318   esac
319   test -n "$enable_debug_configure" &&
320   echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
321
322   if test -f $xsrcdir$name/Implies; then
323     # Collect more names from the `Implies' file (removing comments).
324     implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
325     implied=
326     for x in $implied_candidate; do
327       if test -d $xsrcdir$name_base/$x; then
328         implied="$implied $name_base/$x";
329       else
330         AC_MSG_WARN($name/Implies specifies nonexistent $x)
331       fi
332     done
333   else
334     implied=
335   fi
336
337   # Add NAME to the list of names.
338   names="$names $name"
339
340   # Find the parent of NAME, using the empty string if it has none.
341 changequote(,)dnl
342   parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
343 changequote([,])dnl
344
345   # Add the names implied by NAME, and NAME's parent (if it has one), to
346   # the list of names to be processed (the argument list).  We prepend the
347   # implied names to the list and append the parent.  We want implied
348   # directories to come before further directories inferred from the
349   # configuration components; this ensures that for sysv4, unix/common
350   # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
351   # after sysv4).
352   sysnames="`echo $implied $* $parent`"
353   test -n "$sysnames" && set $sysnames
354 done
355
356 # Add the default directories.
357 sysnames="$names sysdeps/generic sysdeps/stub include"
358 AC_SUBST(sysnames)
359 # The other names were emitted during the scan.
360 AC_MSG_RESULT(sysdeps/generic sysdeps/stub include)
361
362
363 ### Locate tools.
364
365 AC_PROG_INSTALL
366 if test "$INSTALL" = "${srcdir}/install-sh -c"; then
367   # The makefiles need to use a different form to find it in $srcdir.
368   INSTALL='$(..)./install-sh -c'
369 fi
370 AC_PROG_LN_S
371 AC_CHECK_PROGS(MSGFMT, msgfmt gmsgfmt, :)
372
373 AC_PROG_CC_LOCAL
374 AC_CANONICAL_BUILD
375 if test $host != $build; then
376   AC_CHECK_PROGS(BUILD_CC, gcc cc)
377 fi
378 AC_SUBST(cross_compiling)
379 AC_PROG_CPP
380 AC_CHECK_TOOL(AR, ar)
381 AC_CHECK_TOOL(RANLIB, ranlib, :)
382
383 AC_PATH_PROG(BASH, bash, no)
384 if test "$BASH" != no &&
385    $BASH -c 'test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
386   libc_cv_have_bash2=yes
387 else
388   libc_cv_have_bash2=no
389 fi
390 AC_SUBST(libc_cv_have_bash2)
391
392 dnl We need a ksh compatible shell for tzselect.
393 if test "$BASH" = no; then
394   AC_PATH_PROG(KSH, ksh, no)
395   if test "$KSH" = no; then
396     libc_cv_have_ksh=no
397   else
398     libc_cv_have_ksh=yes
399   fi
400 else
401   KSH="$BASH"
402   AC_SUBST(KSH)
403   libc_cv_have_ksh=yes
404 fi
405 AC_SUBST(libc_cv_have_ksh)
406
407 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
408 echo '#include <stddef.h>
409 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
410 if eval "$ac_cpp conftest.c 2>/dev/null" \
411 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
412   libc_cv_signed_size_t=no
413 else
414   libc_cv_signed_size_t=yes
415 fi
416 rm -f conftest*])
417 if test $libc_cv_signed_size_t = yes; then
418   dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
419   cat >> confdefs.h <<\EOF
420 #undef __SIZE_TYPE__
421 #define __SIZE_TYPE__ unsigned
422 EOF
423 fi
424
425 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
426 AC_TRY_COMPILE(dnl
427 [#define __need_size_t
428 #define __need_wchar_t
429 #include <stddef.h>
430 #define __need_NULL
431 #include <stddef.h>], [size_t size; wchar_t wchar;
432 #ifdef offsetof
433 #error stddef.h ignored __need_*
434 #endif
435 if (&size == NULL || &wchar == NULL) abort ();],
436                libc_cv_friendly_stddef=yes,
437                libc_cv_friendly_stddef=no)])
438 if test $libc_cv_friendly_stddef = yes; then
439   config_vars="$config_vars
440 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
441 fi
442
443 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
444                libc_cv_need_minus_P, [dnl
445 cat > conftest.S <<EOF
446 #include "confdefs.h"
447 /* Nothing whatsoever.  */
448 EOF
449 if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
450   libc_cv_need_minus_P=no
451 else
452   libc_cv_need_minus_P=yes
453 fi
454 rm -f conftest*])
455 if test $libc_cv_need_minus_P = yes; then
456   config_vars="$config_vars
457 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
458 fi
459
460 AC_CACHE_CHECK(for assembler global-symbol directive,
461                libc_cv_asm_global_directive, [dnl
462 libc_cv_asm_global_directive=UNKNOWN
463 for ac_globl in .globl .global; do
464   cat > conftest.s <<EOF
465 .text
466 ${ac_globl} foo
467 foo:
468 EOF
469   if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
470     libc_cv_asm_global_directive=${ac_globl}
471   fi
472   rm -f conftest*
473   test $libc_cv_asm_global_directive != UNKNOWN && break
474 done])
475 if test $libc_cv_asm_global_directive = UNKNOWN; then
476   AC_MSG_ERROR(cannot determine asm global directive)
477 else
478   AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
479 fi
480
481 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
482 cat > conftest.s <<EOF
483 .text
484 foo:
485 .set glibc_conftest_frobozz,foo
486 $libc_cv_asm_global_directive glibc_conftest_frobozz
487 EOF
488 # The alpha-dec-osf1 assembler gives only a warning for `.set'
489 # (but it doesn't work), so we must do a linking check to be sure.
490 cat > conftest1.c <<\EOF
491 extern int glibc_conftest_frobozz;
492 main () { printf ("%d\n", glibc_conftest_frobozz); }
493 EOF
494 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
495             -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
496   libc_cv_asm_set_directive=yes
497 else
498   libc_cv_asm_set_directive=no
499 fi
500 rm -f conftest*])
501 if test $libc_cv_asm_set_directive = yes; then
502   AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
503 fi
504
505 AC_CACHE_CHECK(for .symver assembler directive, libc_cv_asm_symver_directive,
506 [cat > conftest.s <<EOF
507 .text
508 _sym:
509 .symver _sym,sym@VERS
510 EOF
511 if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
512   libc_cv_asm_symver_directive=yes
513 else
514   libc_cv_asm_symver_directive=no
515 fi
516 rm -f conftest*])
517 AC_CACHE_CHECK(for ld --version-script, libc_cv_ld_version_script_option, [dnl
518 if test $libc_cv_asm_symver_directive = yes; then
519   cat > conftest.s <<EOF
520 .text
521 _sym:
522 .symver _sym,sym@VERS
523 EOF
524   cat > conftest.map <<EOF
525 VERS {
526         global: sym;
527 };
528 EOF
529   if ${CC-cc} -c $CFLAGS $CPPFLAGS conftest.s 1>&AC_FD_CC 2>&AC_FD_CC; then
530     if AC_TRY_COMMAND([${CC-cc} $CFLAGS --shared -o conftest.so conftest.o
531                                         -Wl,--version-script,conftest.map
532                        1>&AC_FD_CC]);
533     then
534       libc_cv_ld_version_script_option=yes
535     else
536       libc_cv_ld_version_script_option=no
537     fi
538   else
539     libc_cv_ld_version_script_option=no
540   fi
541 else
542   libc_cv_ld_version_script_option=no
543 fi
544 rm -f conftest*])
545 if test $libc_cv_asm_symver_directive = yes &&
546    test $libc_cv_ld_version_script_option = yes; then
547   VERSIONING=yes
548   AC_DEFINE(DO_VERSIONING)
549 else
550   VERSIONING=no
551 fi
552 AC_SUBST(VERSIONING)
553
554 if test $elf = yes; then
555   AC_CACHE_CHECK(for .previous assembler directive,
556                  libc_cv_asm_previous_directive, [dnl
557   cat > conftest.s <<EOF
558 .section foo_section
559 .previous
560 EOF
561   if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
562     libc_cv_asm_previous_directive=yes
563   else
564     libc_cv_asm_previous_directive=no
565   fi
566   rm -f conftest*])
567   if test $libc_cv_asm_previous_directive = yes; then
568     AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
569   else
570     AC_CACHE_CHECK(for .popsection assembler directive,
571                    libc_cv_asm_popsection_directive, [dnl
572     cat > conftest.s <<EOF
573 .pushsection foo_section
574 .popsection
575 EOF
576     if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
577       libc_cv_asm_popsection_directive=yes
578     else
579       libc_cv_asm_popsection_directive=no
580     fi
581     rm -f conftest*])
582     if test $libc_cv_asm_popsection_directive = yes; then
583       AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
584     fi
585   fi
586 fi
587
588 if test $elf != yes; then
589   AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
590                  [AC_TRY_COMPILE(, [asm (".section .init");
591                                     asm (".section .fini");
592                                     asm (".text");],
593                                  libc_cv_have_initfini=yes,
594                                  libc_cv_have_initfini=no)])
595   AC_SUBST(libc_cv_have_initfini)dnl
596   if test $libc_cv_have_initfini = yes; then
597     AC_DEFINE(HAVE_INITFINI)
598   fi
599 fi
600
601 if test $elf = yes; then
602   libc_cv_asm_underscores=no
603 else
604   AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
605                  [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
606                               libc_cv_asm_underscores=yes,
607                               libc_cv_asm_underscores=no)])
608 fi
609 if test $libc_cv_asm_underscores = no; then
610   AC_DEFINE(NO_UNDERSCORES)
611 fi
612
613 if test $elf = yes; then
614   libc_cv_weak_symbols=yes
615   libc_cv_asm_weak_directive=yes
616   libc_cv_asm_weakext_directive=no
617 else
618   AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
619                  [dnl
620 cat > conftest.s <<EOF
621 .text
622 ${libc_cv_asm_global_directive} foo
623 foo:
624 .weak foo
625 .weak bar; bar = foo
626 EOF
627   if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
628     libc_cv_asm_weak_directive=yes
629   else
630     libc_cv_asm_weak_directive=no
631   fi
632   rm -f conftest*])
633
634 if test $libc_cv_asm_weak_directive = no; then
635   AC_CACHE_CHECK(for assembler .weakext directive,
636                  libc_cv_asm_weakext_directive,
637                  [dnl
638 cat > conftest.s <<EOF
639 .text
640 ${libc_cv_asm_global_directive} foo
641 foo:
642 .weakext foo
643 .weakext foo, bar
644 EOF
645   if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
646     libc_cv_asm_weakext_directive=yes
647   else
648     libc_cv_asm_weakext_directive=no
649   fi
650   rm -f conftest*])
651
652   fi # no .weak
653 fi # not ELF
654
655 if test $libc_cv_asm_weak_directive = yes; then
656   AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
657 elif test $libc_cv_asm_weakext_directive = yes; then
658   AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
659 fi
660
661 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
662 cat > conftest.c <<\EOF
663 _start () {}
664 int __eh_pc;
665 __throw () {}
666 EOF
667 dnl No \ in command here because it ends up inside ''.
668 if AC_TRY_COMMAND([${CC-cc} $CFLAGS
669                             -nostdlib -nostartfiles -Wl,--no-whole-archive
670                             -o conftest conftest.c 1>&AC_FD_CC]); then
671   libc_cv_ld_no_whole_archive=yes
672 else
673   libc_cv_ld_no_whole_archive=no
674 fi
675 rm -f conftest*])
676 AC_SUBST(libc_cv_ld_no_whole_archive)dnl
677
678 AC_CACHE_CHECK(for gcc -fno-exceptions, libc_cv_gcc_no_exceptions, [dnl
679 cat > conftest.c <<\EOF
680 _start () {}
681 int __eh_pc;
682 __throw () {}
683 EOF
684 dnl No \ in command here because it ends up inside ''.
685 if AC_TRY_COMMAND([${CC-cc} $CFLAGS
686                             -nostdlib -nostartfiles -fno-exceptions
687                             -o conftest conftest.c 1>&AC_FD_CC]); then
688   libc_cv_gcc_no_exceptions=yes
689 else
690   libc_cv_gcc_no_exceptions=no
691 fi
692 rm -f conftest*])
693 AC_SUBST(libc_cv_gcc_no_exceptions)dnl
694
695 ### End of automated tests.
696 ### Now run sysdeps configure fragments.
697
698 # sysdeps configure fragments may set these with files to be linked below.
699 libc_link_dests=
700 libc_link_sources=
701
702 # Iterate over all the sysdep directories we will use, running their
703 # configure fragments, and looking for a uname implementation.
704 uname=
705 for dir in $sysnames; do
706   case $dir in
707     /*) dest=$dir ;;
708     *)  dest=$srcdir/$dir ;;
709   esac
710   if test -r $dest/configure; then
711     AC_MSG_RESULT(running configure fragment for $dest)
712     . $dest/configure
713   fi
714 [
715   if test -z "$uname"; then
716     if test -r $dest/uname.c ||
717        test -r $dest/uname.S ||
718        { test -r $dest/syscalls.list &&
719          grep '^uname[  ]' $dest/syscalls.list >/dev/null; }; then
720       uname=$dir
721     fi
722   fi
723 ]dnl
724 done
725
726 AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
727
728 # If we will use the generic uname implementation, we must figure out what
729 # it will say by examining the system, and write the results in config-name.h.
730 if test "$uname" = "sysdeps/generic"; then
731
732 changequote(,)dnl
733   uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
734 changequote([,])dnl
735   if test $uname_sysname != $config_os; then
736     config_release=`echo $config_os | sed s/$uname_sysname//`
737   fi
738 dnl
739 AC_DEFUN(LIBC_KERNEL_ID, [dnl
740     if test -r /vmunix; then
741       kernel_id=`strings /vmunix | grep UNIX`
742     elif test -r /dynix; then
743       kernel_id=`strings /dynix | grep DYNIX`
744     else
745       kernel_id=
746     fi
747 ])dnl
748
749   AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
750 AC_REQUIRE([LIBC_KERNEL_ID])dnl
751 changequote(,)dnl
752   kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
753 changequote([,])dnl
754   if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
755          != x$config_release; then
756     # The configuration release is a substring of the kernel release.
757     libc_cv_uname_release=$kernel_release
758   elif test x$config_release != x; then
759     libc_cv_uname_release=$config_release
760   elif test x$kernel_release != x; then
761     libc_cv_uname_release=$kernel_release
762   else
763     libc_cv_uname_release=unknown
764   fi])
765   uname_release="$libc_cv_uname_release"
766
767   AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
768 AC_REQUIRE([LIBC_KERNEL_ID])dnl
769 changequote(,)dnl
770   kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
771 changequote([,])dnl
772   if test -n "$kernel_version"; then
773     libc_cv_uname_version="$kernel_version"
774   else
775     libc_cv_uname_version=unknown
776   fi])
777   uname_version="$libc_cv_uname_version"
778
779 AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
780   config_uname=config-name.h:config-name.in
781 else
782   # For non-generic uname, we don't need to create config-name.h at all.
783   config_uname=
784 fi
785
786 AC_MSG_CHECKING(stdio selection)
787 AC_SUBST(stdio)
788 case $stdio in
789 libio) AC_DEFINE(USE_IN_LIBIO) ;;
790 default) stdio=stdio ;;
791 esac
792 AC_MSG_RESULT($stdio)
793
794 AC_SUBST(libc_cv_slibdir)
795 AC_SUBST(libc_cv_sysconfdir)
796 AC_SUBST(libc_cv_rootsbindir)
797
798 AC_SUBST(has_ldconfig)
799
800 AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf)
801 if test $gnu_ld = yes; then
802   AC_DEFINE(HAVE_GNU_LD)
803 fi
804 if test $gnu_as = yes; then
805   AC_DEFINE(HAVE_GNU_AS)
806 fi
807 if test $elf = yes; then
808   AC_DEFINE(HAVE_ELF)
809 fi
810
811 AC_SUBST(shared)
812 if test $shared = default; then
813   if test $gnu_ld = yes; then
814     shared=$elf
815   else
816     # For now we do not assume shared libs are available.  In future more
817     # tests might become available.
818     shared=no
819   fi
820 fi
821 AC_SUBST(profile)
822 AC_SUBST(omitfp)
823 AC_SUBST(bounded)
824 AC_SUBST(static_nss)
825
826 AC_SUBST(DEFINES)
827
828 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
829   config_makefile=
830 else
831   config_makefile=Makefile
832 fi
833
834 VERSION=`sed -e 's/^#define VERSION "\([^"]*\)"/\1/p' -e d < $srcdir/version.h`
835 AC_SUBST(VERSION)
836
837 AC_OUTPUT(config.make glibcbug ${config_makefile} ${config_uname}, ,
838           [echo '$config_vars' >> config.make; test -d bits || mkdir bits])