1 Dnl Process this file with autoconf to produce a configure script.
3 AC_PREREQ(2.11)dnl dnl Minimum Autoconf version required.
5 AC_CONFIG_HEADER(config.h)
7 # This will get text that should go into config.make.
10 # Check for a --with-gmp argument and set gmp-srcdir in config.make.
12 --with-gmp=DIRECTORY find GMP source code in DIRECTORY (not needed),
15 yes) AC_MSG_ERROR(--with-gmp requires an argument; use --with-gmp=DIRECTORY) ;;
17 *) config_vars="$config_vars
18 gmp-srcdir = $withval" ;;
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),
25 case "$with_gettext" in
27 AC_MSG_ERROR(--with-gettext requires an argument; use --with-gettext=DIR) ;;
30 config_vars="$config_vars
31 gettext-srcdir = $withval" ;;
35 dnl Arguments to specify presence of other packages/features.
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
50 --with-elf if using the ELF object format,
53 AC_ARG_ENABLE(libio, dnl
54 [ --enable-libio build in GNU libio instead of GNU stdio],
55 [if test $enableval = yes; then
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)
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)
79 dnl Generic infrastructure for drop-in additions to libc.
80 AC_ARG_ENABLE(add-ons, dnl
81 [ --enable-add-ons=DIR... configure and build named extra directories],
82 [add_ons=`echo "$enableval" | sed 's/,/ /g'`],
84 AC_CONFIG_SUBDIRS($add_ons)
86 if test x"$add_ons" != x; then
88 add_ons_pfx="$add_ons_pfx $f/"
94 # The way shlib-versions is used to generate soversions.mk uses a
95 # fairly simplistic model for name recognition that can't distinguish
96 # i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a $host_os
97 # of `gnu*' here to be `gnu-gnu*' just so that shlib-versions can
98 # tell. This doesn't get used much beyond that, so it's fairly safe.
103 host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
107 # We keep the original values in `$config_*' and never modify them, so we
108 # can write them unchanged into config.make. Everything else uses
109 # $machine, $vendor, and $os, and changes them whenever convenient.
110 config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
112 # Some configurations imply other options.
114 gnu* | linux* | bsd4.4* | netbsd* | freebsd*)
115 # These systems always use GNU tools.
116 gnu_ld=yes gnu_as=yes ;;
121 gnu* | linux* | sysv4* | solaris2*)
122 # These systems (almost) always use the ELF format.
127 machine=$config_machine
128 vendor=$config_vendor
131 dnl We need to use [ and ] for other purposes for a while now.
133 # Expand the configuration machine name into a subdirectory by architecture
134 # type and particular chip.
136 a29k | am29000) base_machine=a29k machine=a29k ;;
137 alpha*) base_machine=alpha machine=alpha/$machine ;;
138 hppa*) base_machine=hppa machine=hppa/$machine ;;
139 i[3456]86) base_machine=i386 machine=i386/$machine ;;
140 m680?0) base_machine=m68k machine=m68k/$machine ;;
141 m68k) base_machine=m68k machine=m68k/m68020 ;;
142 m88???) base_machine=m88k machine=m88k/$machine ;;
143 m88k) base_machine=m88k machine=m88k/m88100 ;;
144 mips*) base_machine=mips machine=mips/$machine ;;
145 mips64*) base_machine=mips64 machine=mips/mips64/$machine ;;
146 sparc[6789]) base_machine=sparc machine=sparc/$machine ;;
147 supersparc) base_machine=sparc machine=sparc/sparc8 ;;
150 AC_SUBST(base_machine)
152 # Compute the list of sysdep directories for this configuration.
153 # This can take a while to compute.
154 sysdep_dir=$srcdir/sysdeps
155 AC_MSG_CHECKING(sysdep dirs)
156 dnl We need to use [ and ] for other purposes for a while now.
158 # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
159 os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
164 netbsd* | 386bsd* | freebsd* | bsdi*)
165 base_os=unix/bsd/bsd4.4 ;;
166 osf* | sunos* | ultrix* | newsos* | dynix* | *bsd*)
168 sysv* | isc* | esix* | sco* | minix* | irix4* | linux*)
171 base_os=unix/sysv/sysv4 ;;
173 base_os=standalone ;;
178 # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
181 while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
185 o=`echo $tail | sed 's/[0-9]*$//'`
186 if test $o != $tail; then
189 # For linux-gnu, try linux-gnu, then linux.
190 o=`echo $tail | sed 's/-.*$//'`
191 if test $o != $tail; then
195 # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
198 while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
204 # For sparc/sparc9, try sparc/sparc9 and then sparc.
207 while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
209 # Prepend the machine's FPU directory unless --without-fp.
210 if test "$with_fp" = yes; then
217 dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
220 # Find what sysdep directories exist.
222 IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
223 for d in $add_ons_pfx ''; do
224 for b in $base ''; do
225 for m0 in $mach ''; do
226 for v in /$vendor ''; do
227 for o in /$ostry ''; do
228 for m in $mach ''; do
229 if test "$m0$b$v$o$m"; then
230 try="${d}sysdeps$m0$b$v$o$m"
231 test -n "$enable_debug_configure" &&
232 echo "$0 [DEBUG]: try $try" >&2
235 *) dest=$srcdir/$try ;;
237 if test -d $dest; then
238 sysnames="$sysnames $try"
239 { test -n "$o" || test -n "$b"; } && os_used=t
240 { test -n "$m" || test -n "$m0"; } && machine_used=t
251 if test -z "$os_used" && test "$os" != none; then
252 AC_MSG_ERROR(Operating system $os is not supported.)
254 if test -z "$machine_used" && test "$machine" != none; then
255 AC_MSG_ERROR(The $machine is not supported.)
258 # We have now validated the configuration.
261 # If using ELF, look for an `elf' subdirectory of each machine directory.
262 # We prepend these rather than inserting them whereever the machine appears
263 # because things specified by the machine's ELF ABI should override
264 # OS-specific things, and should always be the same for any OS on the
265 # machine (otherwise what's the point of an ABI?).
266 if test "$elf" = yes; then
268 for d in $add_ons_pfx ''; do
271 *) xsrcdir=$srcdir/ ;;
274 if test -d $xsrcdir${d}sysdeps$m/elf; then
275 elf_dirs="$elf_dirs ${d}sysdeps$m/elf"
279 sysnames="`echo $elf_dirs | sed -e 's,//,/,g'` $sysnames"
283 # Expand the list of system names into a full list of directories
284 # from each element's parent name and Implies file (if present).
287 while test $# -gt 0; do
291 case " $names " in *" $name "*)
292 # Already in the list.
296 # Report each name as we discover it, so there is no long pause in output.
297 echo $ac_n "$name $ac_c" >&AC_FD_MSG
299 name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
303 *) xsrcdir=$srcdir/ ;;
305 test -n "$enable_debug_configure" &&
306 echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
308 if test -f $xsrcdir$name/Implies; then
309 # Collect more names from the `Implies' file (removing comments).
310 implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/Implies`"
312 for x in $implied_candidate; do
313 if test -d $xsrcdir$name_base/$x; then
314 implied="$implied $name_base/$x";
316 AC_MSG_WARN($name/Implies specifies nonexistent $x)
323 # Add NAME to the list of names.
326 # Find the parent of NAME, using the empty string if it has none.
328 parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
331 # Add the names implied by NAME, and NAME's parent (if it has one), to
332 # the list of names to be processed (the argument list). We prepend the
333 # implied names to the list and append the parent. We want implied
334 # directories to come before further directories inferred from the
335 # configuration components; this ensures that for sysv4, unix/common
336 # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
338 sysnames="`echo $implied $* $parent`"
339 test -n "$sysnames" && set $sysnames
342 # Add the default directories.
343 sysnames="$names sysdeps/generic sysdeps/stub"
345 # The other names were emitted during the scan.
346 AC_MSG_RESULT(sysdeps/generic sysdeps/stub)
352 if test "$INSTALL" = "${srcdir}/install-sh -c"; then
353 # The makefiles need to use a different form to find it in $srcdir.
354 INSTALL='$(..)./install-sh -c'
357 AC_CHECK_PROGS(MSGFMT, msgfmt gmsgfmt, :)
359 AC_CHECK_TOOL(CC, gcc)
360 if test $host != $build; then
361 AC_CHECK_PROG(BUILD_CC, gcc cc)
364 AC_CHECK_TOOL(AR, ar)
365 AC_CHECK_TOOL(RANLIB, ranlib, :)
367 AC_PATH_PROG(BASH, bash, no)
368 if test "$BASH" != no &&
369 $BASH -c 'test "$BASH_VERSINFO" -ge 2 >&/dev/null'; then
370 libc_cv_have_bash2=yes
372 libc_cv_have_bash2=no
374 AC_SUBST(libc_cv_have_bash2)
376 dnl We need a ksh compatible shell for tzselect.
377 if test "$BASH" = no; then
378 AC_PATH_PROG(KSH, ksh, no)
379 if test "$KSH" = no; then
389 AC_SUBST(libc_cv_have_ksh)
391 AC_CACHE_CHECK(for signed size_t type, libc_cv_signed_size_t, [dnl
392 echo '#include <stddef.h>
393 FOOBAR __SIZE_TYPE__ FOOBAR' > conftest.c
394 if eval "$ac_cpp conftest.c 2>/dev/null" \
395 | grep '^FOOBAR.*unsigned.*FOOBAR$' >/dev/null; then
396 libc_cv_signed_size_t=no
398 libc_cv_signed_size_t=yes
401 if test $libc_cv_signed_size_t = yes; then
402 dnl Do this by hand instead of AC_DEFINE so can add #undef to avoid warnings.
403 cat >> confdefs.h <<\EOF
405 #define __SIZE_TYPE__ unsigned
409 AC_CACHE_CHECK(for libc-friendly stddef.h, libc_cv_friendly_stddef, [dnl
411 [#define __need_size_t
412 #define __need_wchar_t
415 #include <stddef.h>], [size_t size; wchar_t wchar;
417 #error stddef.h ignored __need_*
419 if (&size == NULL || &wchar == NULL) abort ();],
420 libc_cv_friendly_stddef=yes,
421 libc_cv_friendly_stddef=no)])
422 if test $libc_cv_friendly_stddef = yes; then
423 config_vars="$config_vars
424 override stddef.h = # The installed <stddef.h> seems to be libc-friendly."
427 AC_CACHE_CHECK(whether we need to use -P to assemble .S files,
428 libc_cv_need_minus_P, [dnl
429 cat > conftest.S <<EOF
430 #include "confdefs.h"
431 /* Nothing whatsoever. */
433 if ${CC-cc} $CFLAGS -c conftest.S 2>/dev/null; then
434 libc_cv_need_minus_P=no
436 libc_cv_need_minus_P=yes
439 if test $libc_cv_need_minus_P = yes; then
440 config_vars="$config_vars
441 asm-CPPFLAGS = -P # The assembler can't grok cpp's # line directives."
444 AC_CACHE_CHECK(for assembler global-symbol directive,
445 libc_cv_asm_global_directive, [dnl
446 libc_cv_asm_global_directive=UNKNOWN
447 for ac_globl in .globl .global; do
448 cat > conftest.s <<EOF
453 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
454 libc_cv_asm_global_directive=${ac_globl}
457 test $libc_cv_asm_global_directive != UNKNOWN && break
459 if test $libc_cv_asm_global_directive = UNKNOWN; then
460 AC_MSG_ERROR(cannot determine asm global directive)
462 AC_DEFINE_UNQUOTED(ASM_GLOBAL_DIRECTIVE, ${libc_cv_asm_global_directive})
465 AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
466 cat > conftest.s <<EOF
469 .set glibc_conftest_frobozz,foo
470 $libc_cv_asm_global_directive glibc_conftest_frobozz
472 # The alpha-dec-osf1 assembler gives only a warning for `.set'
473 # (but it doesn't work), so we must do a linking check to be sure.
474 cat > conftest1.c <<\EOF
475 extern int glibc_conftest_frobozz;
476 main () { printf ("%d\n", glibc_conftest_frobozz); }
478 if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
479 -o conftest conftest.s conftest1.c 1>&AC_FD_CC 2>&AC_FD_CC; then
480 libc_cv_asm_set_directive=yes
482 libc_cv_asm_set_directive=no
485 if test $libc_cv_asm_set_directive = yes; then
486 AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
489 if test $elf = yes; then
490 AC_CACHE_CHECK(for .previous assembler directive,
491 libc_cv_asm_previous_directive, [dnl
492 cat > conftest.s <<EOF
496 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
497 libc_cv_asm_previous_directive=yes
499 libc_cv_asm_previous_directive=no
502 if test $libc_cv_asm_previous_directive = yes; then
503 AC_DEFINE(HAVE_ASM_PREVIOUS_DIRECTIVE)
505 AC_CACHE_CHECK(for .popsection assembler directive,
506 libc_cv_asm_popsection_directive, [dnl
507 cat > conftest.s <<EOF
508 .pushsection foo_section
511 if AC_TRY_COMMAND(${CC-cc} -c $CFLAGS conftest.s 1>&AC_FD_CC); then
512 libc_cv_asm_popsection_directive=yes
514 libc_cv_asm_popsection_directive=no
517 if test $libc_cv_asm_popsection_directive = yes; then
518 AC_DEFINE(HAVE_ASM_POPSECTION_DIRECTIVE)
523 if test $elf != yes; then
524 AC_CACHE_CHECK(for .init and .fini sections, libc_cv_have_initfini,
525 [AC_TRY_COMPILE(, [asm (".section .init");
526 asm (".section .fini");
528 libc_cv_have_initfini=yes,
529 libc_cv_have_initfini=no)])
530 AC_SUBST(libc_cv_have_initfini)dnl
531 if test $libc_cv_have_initfini = yes; then
532 AC_DEFINE(HAVE_INITFINI)
536 if test $elf = yes; then
537 libc_cv_asm_underscores=no
539 AC_CACHE_CHECK(for _ prefix on C symbol names, libc_cv_asm_underscores,
540 [AC_TRY_LINK([asm ("_glibc_foobar:");], [glibc_foobar ();],
541 libc_cv_asm_underscores=yes,
542 libc_cv_asm_underscores=no)])
544 if test $libc_cv_asm_underscores = no; then
545 AC_DEFINE(NO_UNDERSCORES)
548 if test $elf = yes; then
549 libc_cv_weak_symbols=yes
550 libc_cv_asm_weak_directive=yes
551 libc_cv_asm_weakext_directive=no
553 AC_CACHE_CHECK(for assembler .weak directive, libc_cv_asm_weak_directive,
555 cat > conftest.s <<EOF
557 ${libc_cv_asm_global_directive} foo
562 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
563 libc_cv_asm_weak_directive=yes
565 libc_cv_asm_weak_directive=no
569 if test $libc_cv_asm_weak_directive = no; then
570 AC_CACHE_CHECK(for assembler .weakext directive,
571 libc_cv_asm_weakext_directive,
573 cat > conftest.s <<EOF
575 ${libc_cv_asm_global_directive} foo
580 if ${CC-cc} $CFLAGS -c conftest.s 2>/dev/null; then
581 libc_cv_asm_weakext_directive=yes
583 libc_cv_asm_weakext_directive=no
590 if test $libc_cv_asm_weak_directive = yes; then
591 AC_DEFINE(HAVE_ASM_WEAK_DIRECTIVE)
592 elif test $libc_cv_asm_weakext_directive = yes; then
593 AC_DEFINE(HAVE_ASM_WEAKEXT_DIRECTIVE)
596 AC_CACHE_CHECK(for ld --no-whole-archive, libc_cv_ld_no_whole_archive, [dnl
597 cat > conftest.c <<\EOF
602 dnl No \ in command here because it ends up inside ''.
603 if AC_TRY_COMMAND([${CC-cc} $CFLAGS
604 -nostdlib -nostartfiles -Wl,--no-whole-archive
605 -o conftest conftest.c]); then
606 libc_cv_ld_no_whole_archive=yes
608 libc_cv_ld_no_whole_archive=no
611 AC_SUBST(libc_cv_ld_no_whole_archive)dnl
613 AC_CACHE_CHECK(for gcc -fno-exceptions, libc_cv_gcc_no_exceptions, [dnl
614 cat > conftest.c <<\EOF
619 dnl No \ in command here because it ends up inside ''.
620 if AC_TRY_COMMAND([${CC-cc} $CFLAGS
621 -nostdlib -nostartfiles -fno-exceptions
622 -o conftest conftest.c]); then
623 libc_cv_gcc_no_exceptions=yes
625 libc_cv_gcc_no_exceptions=no
628 AC_SUBST(libc_cv_gcc_no_exceptions)dnl
630 ### End of automated tests.
631 ### Now run sysdeps configure fragments.
633 # sysdeps configure fragments may set these with files to be linked below.
637 # Iterate over all the sysdep directories we will use, running their
638 # configure fragments, and looking for a uname implementation.
640 for dir in $sysnames; do
643 *) dest=$srcdir/$dir ;;
645 if test -r $dest/configure; then
646 AC_MSG_RESULT(running configure fragment for $dest)
650 if test -z "$uname"; then
651 if test -r $sysdep_dir/$dir/uname.c ||
652 test -r $sysdep_dir/$dir/uname.S ||
653 { test -r $sysdep_dir/$dir/syscalls.list &&
654 grep '^uname[ ]' $sysdep_dir/$dir/syscalls.list >/dev/null; }; then
661 AC_LINK_FILES(`echo $libc_link_sources`, `echo $libc_link_dests`)
663 # If we will use the generic uname implementation, we must figure out what
664 # it will say by examining the system, and write the results in config-name.h.
665 if test "$uname" = generic; then
668 uname_sysname=`echo $config_os | sed 's/[0-9.]*$//'`
670 if test $uname_sysname != $config_os; then
671 config_release=`echo $config_os | sed s/$uname_sysname//`
674 AC_DEFUN(LIBC_KERNEL_ID, [dnl
675 if test -r /vmunix; then
676 kernel_id=`strings /vmunix | grep UNIX`
677 elif test -r /dynix; then
678 kernel_id=`strings /dynix | grep DYNIX`
684 AC_CACHE_CHECK(OS release for uname, libc_cv_uname_release, [dnl
685 AC_REQUIRE([LIBC_KERNEL_ID])dnl
687 kernel_release=`echo "$kernel_id" | sed 's/^[^0-9.]*\([0-9.]*\).*$/\1/'`
689 if test x`echo "$config_release" | sed "s/^$kernel_release//"` \
690 != x$config_release; then
691 # The configuration release is a substring of the kernel release.
692 libc_cv_uname_release=$kernel_release
693 elif test x$config_release != x; then
694 libc_cv_uname_release=$config_release
695 elif test x$kernel_release != x; then
696 libc_cv_uname_release=$kernel_release
698 libc_cv_uname_release=unknown
700 uname_release="$libc_cv_uname_release"
702 AC_CACHE_CHECK(OS version for uname, libc_cv_uname_version, [dnl
703 AC_REQUIRE([LIBC_KERNEL_ID])dnl
705 kernel_version=`echo "$kernel_id" | sed 's/^[^#]*#\([0-9]*\).*$/\1/'`
707 if test -n "$kernel_version"; then
708 libc_cv_uname_version="$kernel_version"
710 libc_cv_uname_version=unknown
712 uname_version="$libc_cv_uname_version"
714 AC_SUBST(uname_sysname) AC_SUBST(uname_release) AC_SUBST(uname_version)dnl
715 config_uname=config-name.h:config-name.in
717 # For non-generic uname, we don't need to create config-name.h at all.
721 AC_MSG_CHECKING(stdio selection)
724 libio) AC_DEFINE(USE_IN_LIBIO) ;;
725 default) stdio=stdio ;;
727 AC_MSG_RESULT($stdio)
729 AC_SUBST(libc_cv_slibdir)
730 AC_SUBST(libc_cv_sysconfdir)
731 AC_SUBST(libc_cv_rootsbindir)
733 AC_SUBST(has_ldconfig)
735 AC_SUBST(gnu_ld) AC_SUBST(gnu_as) AC_SUBST(elf)
736 if test $gnu_ld = yes; then
737 AC_DEFINE(HAVE_GNU_LD)
739 if test $gnu_as = yes; then
740 AC_DEFINE(HAVE_GNU_AS)
742 if test $elf = yes; then
747 if test $shared = default; then
748 if test $gnu_ld = yes; then
751 # For now we do not assume shared libs are available. In future more
752 # tests might become available.
761 if test "`(cd $srcdir; pwd)`" = "`pwd`"; then
764 config_makefile=Makefile
767 VERSION=`sed -e 's/^#define VERSION "\([^"]*\)"/\1/p' -e d < $srcdir/version.h`
770 AC_OUTPUT(config.make glibcbug ${config_makefile} ${config_uname}, ,
771 [echo '$config_vars' >> config.make])