11 kx dnl Process this file with autoconf to produce a configure script.
11 kx dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
11 kx AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/],
11 kx [glibc], [https://www.gnu.org/software/glibc/])
11 kx AC_CONFIG_SRCDIR([include/features.h])
11 kx AC_CONFIG_HEADERS([config.h])
11 kx AC_CONFIG_AUX_DIR([scripts])
11 kx
11 kx ACX_PKGVERSION([GNU libc])
11 kx ACX_BUGURL([https://www.gnu.org/software/libc/bugs.html])
11 kx AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
11 kx [Package description])
11 kx AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
11 kx [Bug reporting address])
11 kx
11 kx # Glibc should not depend on any header files
11 kx AC_DEFUN([_AC_INCLUDES_DEFAULT_REQUIREMENTS],
11 kx [m4_divert_text([DEFAULTS],
11 kx [ac_includes_default='/* none */'])])
11 kx
11 kx # We require GCC, and by default use its preprocessor. Override AC_PROG_CPP
11 kx # here to work around the Autoconf issue discussed in
11 kx # <https://sourceware.org/ml/libc-alpha/2013-01/msg00721.html>.
11 kx AC_DEFUN([AC_PROG_CPP],
11 kx [AC_REQUIRE([AC_PROG_CC])dnl
11 kx AC_ARG_VAR([CPP], [C preprocessor])dnl
11 kx _AC_ARG_VAR_CPPFLAGS()dnl
11 kx # On Suns, sometimes $CPP names a directory.
11 kx if test -n "$CPP" && test -d "$CPP"; then
11 kx CPP=
11 kx fi
11 kx if test -z "$CPP"; then
11 kx CPP="$CC -E"
11 kx fi
11 kx AC_SUBST(CPP)dnl
11 kx ])# AC_PROG_CPP
11 kx
11 kx # We require GCC. Override _AC_PROG_CC_C89 here to work around the Autoconf
11 kx # issue discussed in
11 kx # <https://sourceware.org/ml/libc-alpha/2013-01/msg00757.html>.
11 kx AC_DEFUN([_AC_PROG_CC_C89], [[$1]])
11 kx
11 kx dnl This is here so we can set $subdirs directly based on configure fragments.
11 kx AC_CONFIG_SUBDIRS()
11 kx
11 kx AC_CANONICAL_HOST
11 kx
11 kx AC_PROG_CC
11 kx if test $host != $build; then
11 kx AC_CHECK_PROGS(BUILD_CC, gcc cc)
11 kx fi
11 kx AC_SUBST(cross_compiling)
11 kx AC_PROG_CPP
11 kx
11 kx # We need the C++ compiler only for testing.
11 kx AC_PROG_CXX
11 kx # It's useless to us if it can't link programs (e.g. missing -lstdc++).
11 kx AC_CACHE_CHECK([whether $CXX can link programs], libc_cv_cxx_link_ok, [dnl
11 kx AC_LANG_PUSH([C++])
11 kx # Default, dynamic case.
11 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])],
11 kx [libc_cv_cxx_link_ok=yes],
11 kx [libc_cv_cxx_link_ok=no])
11 kx # Static case.
11 kx old_LDFLAGS="$LDFLAGS"
11 kx LDFLAGS="$LDFLAGS -static"
11 kx AC_LINK_IFELSE([AC_LANG_SOURCE([
11 kx #include <iostream>
11 kx
11 kx int
11 kx main()
11 kx {
11 kx std::cout << "Hello, world!";
11 kx return 0;
11 kx }
11 kx ])],
11 kx [],
11 kx [libc_cv_cxx_link_ok=no])
11 kx LDFLAGS="$old_LDFLAGS"
11 kx AC_LANG_POP([C++])])
11 kx AS_IF([test $libc_cv_cxx_link_ok != yes], [CXX=])
11 kx
11 kx if test "`cd $srcdir; pwd -P`" = "`pwd -P`"; then
11 kx AC_MSG_ERROR([you must configure in a separate build directory])
11 kx fi
11 kx
11 kx # This will get text that should go into config.make.
11 kx config_vars=
11 kx
11 kx # Check for a --with-gd argument and set libgd-LDFLAGS in config.make.
11 kx AC_ARG_WITH([gd],
11 kx AS_HELP_STRING([--with-gd=DIR],
11 kx [find libgd include dir and library with prefix DIR]),
11 kx [dnl
11 kx case "$with_gd" in
11 kx yes|''|no) ;;
11 kx *) libgd_include="-I$withval/include"
11 kx libgd_ldflags="-L$withval/lib" ;;
11 kx esac
11 kx ])
11 kx AC_ARG_WITH([gd-include],
11 kx AS_HELP_STRING([--with-gd-include=DIR],
11 kx [find libgd include files in DIR]),
11 kx [dnl
11 kx case "$with_gd_include" in
11 kx ''|no) ;;
11 kx *) libgd_include="-I$withval" ;;
11 kx esac
11 kx ])
11 kx AC_ARG_WITH([gd-lib],
11 kx AS_HELP_STRING([--with-gd-lib=DIR],
11 kx [find libgd library files in DIR]),
11 kx [dnl
11 kx case "$with_gd_lib" in
11 kx ''|no) ;;
11 kx *) libgd_ldflags="-L$withval" ;;
11 kx esac
11 kx ])
11 kx
11 kx if test -n "$libgd_include"; then
11 kx config_vars="$config_vars
11 kx CFLAGS-memusagestat.c = $libgd_include"
11 kx fi
11 kx if test -n "$libgd_ldflags"; then
11 kx config_vars="$config_vars
11 kx libgd-LDFLAGS = $libgd_ldflags"
11 kx fi
11 kx
11 kx dnl Arguments to specify presence of other packages/features.
11 kx AC_ARG_WITH([binutils],
11 kx AS_HELP_STRING([--with-binutils=PATH],
11 kx [specify location of binutils (as and ld)]),
11 kx [path_binutils=$withval],
11 kx [path_binutils=''])
11 kx AC_ARG_WITH([selinux],
11 kx AS_HELP_STRING([--with-selinux],
11 kx [if building with SELinux support]),
11 kx [with_selinux=$withval],
11 kx [with_selinux=auto])
11 kx
11 kx AC_ARG_WITH([headers],
11 kx AS_HELP_STRING([--with-headers=PATH],
11 kx [location of system headers to use
11 kx (for example /usr/src/linux/include)
11 kx @<:@default=compiler default@:>@]),
11 kx [sysheaders=$withval],
11 kx [sysheaders=''])
11 kx AC_SUBST(sysheaders)
11 kx
11 kx AC_SUBST(use_default_link)
11 kx AC_ARG_WITH([default-link],
11 kx AS_HELP_STRING([--with-default-link],
11 kx [do not use explicit linker scripts]),
11 kx [use_default_link=$withval],
11 kx [use_default_link=no])
11 kx
11 kx dnl Additional build flags injection.
11 kx AC_ARG_WITH([nonshared-cflags],
11 kx AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
11 kx [build nonshared libraries with additional CFLAGS]),
11 kx [extra_nonshared_cflags=$withval],
11 kx [extra_nonshared_cflags=])
11 kx AC_SUBST(extra_nonshared_cflags)
11 kx AC_ARG_WITH([rtld-early-cflags],
11 kx AS_HELP_STRING([--with-rtld-early-cflags=CFLAGS],
11 kx [build early initialization with additional CFLAGS]),
11 kx [rtld_early_cflags=$withval],
11 kx [rtld_early_cflags=])
11 kx AC_SUBST(rtld_early_cflags)
11 kx
11 kx AC_ARG_WITH([timeoutfactor],
11 kx AS_HELP_STRING([--with-timeoutfactor=NUM],
11 kx [specify an integer to scale the timeout]),
11 kx [timeoutfactor=$withval],
11 kx [timeoutfactor=1])
11 kx AC_DEFINE_UNQUOTED(TIMEOUTFACTOR, $timeoutfactor)
11 kx
11 kx AC_ARG_ENABLE([sanity-checks],
11 kx AS_HELP_STRING([--disable-sanity-checks],
11 kx [really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
11 kx [enable_sanity=$enableval],
11 kx [enable_sanity=yes])
11 kx
11 kx AC_ARG_ENABLE([shared],
11 kx AS_HELP_STRING([--enable-shared],
11 kx [build shared library @<:@default=yes if GNU ld@:>@]),
11 kx [shared=$enableval],
11 kx [shared=yes])
11 kx AC_ARG_ENABLE([profile],
11 kx AS_HELP_STRING([--enable-profile],
11 kx [build profiled library @<:@default=no@:>@]),
11 kx [profile=$enableval],
11 kx [profile=no])
11 kx AC_ARG_ENABLE([default-pie],
11 kx AS_HELP_STRING([--disable-default-pie],
11 kx [Do not build glibc programs and the testsuite as PIE @<:@default=no@:>@]),
11 kx [default_pie=$enableval],
11 kx [default_pie=yes])
11 kx AC_ARG_ENABLE([timezone-tools],
11 kx AS_HELP_STRING([--disable-timezone-tools],
11 kx [do not install timezone tools @<:@default=install@:>@]),
11 kx [enable_timezone_tools=$enableval],
11 kx [enable_timezone_tools=yes])
11 kx AC_SUBST(enable_timezone_tools)
11 kx
11 kx AC_ARG_ENABLE([hardcoded-path-in-tests],
11 kx AS_HELP_STRING([--enable-hardcoded-path-in-tests],
11 kx [hardcode newly built glibc path in tests @<:@default=no@:>@]),
11 kx [hardcoded_path_in_tests=$enableval],
11 kx [hardcoded_path_in_tests=no])
11 kx AC_SUBST(hardcoded_path_in_tests)
11 kx
11 kx AC_ARG_ENABLE([hidden-plt],
11 kx AS_HELP_STRING([--disable-hidden-plt],
11 kx [do not hide internal function calls to avoid PLT]),
11 kx [hidden=$enableval],
11 kx [hidden=yes])
11 kx if test "x$hidden" = xno; then
11 kx AC_DEFINE(NO_HIDDEN)
11 kx fi
11 kx
11 kx AC_ARG_ENABLE([bind-now],
11 kx AS_HELP_STRING([--enable-bind-now],
11 kx [disable lazy relocations in DSOs]),
11 kx [bindnow=$enableval],
11 kx [bindnow=no])
11 kx AC_SUBST(bindnow)
11 kx if test "x$bindnow" = xyes; then
11 kx AC_DEFINE(BIND_NOW)
11 kx fi
11 kx
11 kx dnl Build glibc with -fstack-protector, -fstack-protector-all, or
11 kx dnl -fstack-protector-strong.
11 kx AC_ARG_ENABLE([stack-protector],
11 kx AS_HELP_STRING([--enable-stack-protector=@<:@yes|no|all|strong@:>@],
11 kx [Use -fstack-protector[-all|-strong] to detect glibc buffer overflows]),
11 kx [enable_stack_protector=$enableval],
11 kx [enable_stack_protector=no])
11 kx case "$enable_stack_protector" in
11 kx all|yes|no|strong) ;;
11 kx *) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
11 kx esac
11 kx
11 kx dnl On some platforms we cannot use dynamic loading. We must provide
11 kx dnl static NSS modules.
11 kx AC_ARG_ENABLE([static-nss],
11 kx AS_HELP_STRING([--enable-static-nss],
11 kx [build static NSS modules @<:@default=no@:>@]),
11 kx [static_nss=$enableval],
11 kx [static_nss=no])
11 kx dnl Enable static NSS also if we build no shared objects.
11 kx if test x"$static_nss" = xyes || test x"$shared" = xno; then
11 kx static_nss=yes
11 kx AC_DEFINE(DO_STATIC_NSS)
11 kx fi
11 kx
11 kx AC_ARG_ENABLE([force-install],
11 kx AS_HELP_STRING([--disable-force-install],
11 kx [don't force installation of files from this package, even if they are older than the installed files]),
11 kx [force_install=$enableval],
11 kx [force_install=yes])
11 kx AC_SUBST(force_install)
11 kx
11 kx AC_ARG_ENABLE([maintainer-mode],
11 kx AS_HELP_STRING([--enable-maintainer-mode],
11 kx [enable make rules and dependencies not useful (and sometimes confusing) to the casual installer]),
11 kx [maintainer=$enableval],
11 kx [maintainer=no])
11 kx
11 kx dnl On some platforms we allow dropping compatibility with all kernel
11 kx dnl versions.
11 kx AC_ARG_ENABLE([kernel],
11 kx AS_HELP_STRING([--enable-kernel=VERSION],
11 kx [compile for compatibility with kernel not older than VERSION]),
11 kx [minimum_kernel=$enableval],
11 kx [])
11 kx dnl Prevent unreasonable values.
11 kx if test "$minimum_kernel" = yes || test "$minimum_kernel" = no; then
11 kx # Better nothing than this.
11 kx minimum_kernel=""
11 kx else
11 kx if test "$minimum_kernel" = current; then
11 kx minimum_kernel=`uname -r 2>/dev/null` || minimum_kernel=
11 kx fi
11 kx fi
11 kx
11 kx dnl For the development we sometimes want gcc to issue even more warnings.
11 kx dnl This is not the default since many of the extra warnings are not
11 kx dnl appropriate.
11 kx AC_ARG_ENABLE([all-warnings],
11 kx AS_HELP_STRING([--enable-all-warnings],
11 kx [enable all useful warnings gcc can issue]),
11 kx [all_warnings=$enableval],
11 kx [])
11 kx AC_SUBST(all_warnings)
11 kx
11 kx AC_ARG_ENABLE([werror],
11 kx AS_HELP_STRING([--disable-werror],
11 kx [do not build with -Werror]),
11 kx [enable_werror=$enableval],
11 kx [enable_werror=yes])
11 kx AC_SUBST(enable_werror)
11 kx
11 kx AC_ARG_ENABLE([multi-arch],
11 kx AS_HELP_STRING([--enable-multi-arch],
11 kx [enable single DSO with optimizations for multiple architectures]),
11 kx [multi_arch=$enableval],
11 kx [multi_arch=default])
11 kx
11 kx AC_ARG_ENABLE([experimental-malloc],
11 kx AS_HELP_STRING([--disable-experimental-malloc],
11 kx [disable experimental malloc features]),
11 kx [experimental_malloc=$enableval],
11 kx [experimental_malloc=yes])
11 kx AC_SUBST(experimental_malloc)
11 kx
11 kx AC_ARG_ENABLE([memory-tagging],
11 kx AS_HELP_STRING([--enable-memory-tagging],
11 kx [enable memory tagging if supported by the architecture @<:@default=no@:>@]),
11 kx [memory_tagging=$enableval],
11 kx [memory_tagging=no])
11 kx if test "$memory_tagging" = yes; then
11 kx # Only enable this on architectures that support it.
11 kx case $host_cpu in
11 kx aarch64)
11 kx AC_DEFINE(USE_MTAG)
11 kx ;;
11 kx esac
11 kx fi
11 kx AC_SUBST(memory_tagging)
11 kx
11 kx AC_ARG_ENABLE([crypt],
11 kx AS_HELP_STRING([--disable-crypt],
11 kx [do not build nor install the passphrase hashing library, libcrypt]),
11 kx [build_crypt=$enableval],
11 kx [build_crypt=yes])
11 kx AC_SUBST(build_crypt)
11 kx
11 kx AC_ARG_ENABLE([nss-crypt],
11 kx AS_HELP_STRING([--enable-nss-crypt],
11 kx [enable libcrypt to use nss]),
11 kx [nss_crypt=$enableval],
11 kx [nss_crypt=no])
11 kx if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then
11 kx AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled])
11 kx nss_crypt=no
11 kx fi
11 kx if test x$nss_crypt = xyes; then
11 kx nss_includes=-I$(nss-config --includedir 2>/dev/null)
11 kx if test $? -ne 0; then
11 kx AC_MSG_ERROR([cannot find include directory with nss-config])
11 kx fi
11 kx nspr_includes=-I$(nspr-config --includedir 2>/dev/null)
11 kx if test $? -ne 0; then
11 kx AC_MSG_ERROR([cannot find include directory with nspr-config])
11 kx fi
11 kx old_CFLAGS="$CFLAGS"
11 kx CFLAGS="$CFLAGS $nss_includes $nspr_includes"
11 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
11 kx #include <hasht.h>
11 kx #include <nsslowhash.h>
11 kx void f (void) { NSSLOW_Init (); }])],
11 kx libc_cv_nss_crypt=yes,
11 kx AC_MSG_ERROR([
11 kx cannot find NSS headers with lowlevel hash function interfaces]))
11 kx old_LIBS="$LIBS"
11 kx old_LDFLAGS="$LDFLAGS"
11 kx LIBS="$LIBS -lfreebl3"
11 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
11 kx #include <hasht.h>
11 kx #include <nsslowhash.h>],
11 kx [NSSLOW_Init();])],
11 kx libc_cv_nss_crypt=yes,
11 kx AC_MSG_ERROR([
11 kx cannot link program using lowlevel NSS hash functions]))
11 kx # Check to see if there is a static NSS cryptographic library.
11 kx # If there isn't then we can't link anything with libcrypt.a,
11 kx # and that might mean disabling some static tests.
11 kx LDFLAGS="$LDFLAGS -static"
11 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([typedef int PRBool;
11 kx #include <hasht.h>
11 kx #include <nsslowhash.h>],
11 kx [NSSLOW_Init();])],
11 kx libc_cv_static_nss_crypt=yes,
11 kx libc_cv_static_nss_crypt=no)
11 kx LDFLAGS="$old_LDFLAGS"
11 kx CFLAGS="$old_CFLAGS"
11 kx LIBS="$old_LIBS"
11 kx else
11 kx libc_cv_nss_crypt=no
11 kx libc_cv_static_nss_crypt=no
11 kx fi
11 kx AC_SUBST(libc_cv_nss_crypt)
11 kx AC_SUBST(libc_cv_static_nss_crypt)
11 kx
11 kx
11 kx AC_ARG_ENABLE([systemtap],
11 kx [AS_HELP_STRING([--enable-systemtap],
11 kx [enable systemtap static probe points @<:@default=no@:>@])],
11 kx [systemtap=$enableval],
11 kx [systemtap=no])
11 kx if test "x$systemtap" != xno; then
11 kx AC_CACHE_CHECK([for systemtap static probe support], libc_cv_sdt, [dnl
11 kx old_CFLAGS="$CFLAGS"
11 kx CFLAGS="-std=gnu11 $CFLAGS"
11 kx AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#include <sys/sdt.h>
11 kx void foo (int i, void *p)
11 kx {
11 kx asm ("" STAP_PROBE_ASM (foo, bar, STAP_PROBE_ASM_TEMPLATE (2)) ""
11 kx :: STAP_PROBE_ASM_OPERANDS (2, i, p));
11 kx }]])], [libc_cv_sdt=yes], [libc_cv_sdt=no])
11 kx CFLAGS="$old_CFLAGS"])
11 kx if test $libc_cv_sdt = yes; then
11 kx AC_DEFINE([USE_STAP_PROBE])
11 kx elif test "x$systemtap" != xauto; then
11 kx AC_MSG_FAILURE([systemtap support needs sys/sdt.h with asm support])
11 kx fi
11 kx fi
11 kx
11 kx AC_ARG_ENABLE([build-nscd],
11 kx [AS_HELP_STRING([--disable-build-nscd],
11 kx [disable building and installing the nscd daemon])],
11 kx [build_nscd=$enableval],
11 kx [build_nscd=default])
11 kx AC_SUBST(build_nscd)
11 kx
11 kx # Note the use of $use_nscd is near the bottom of the file.
11 kx AC_ARG_ENABLE([nscd],
11 kx [AS_HELP_STRING([--disable-nscd],
11 kx [library functions will not contact the nscd daemon])],
11 kx [use_nscd=$enableval],
11 kx [use_nscd=yes])
11 kx
11 kx AC_ARG_ENABLE([pt_chown],
11 kx [AS_HELP_STRING([--enable-pt_chown],
11 kx [Enable building and installing pt_chown])],
11 kx [build_pt_chown=$enableval],
11 kx [build_pt_chown=no])
11 kx AC_SUBST(build_pt_chown)
11 kx if test "$build_pt_chown" = yes; then
11 kx AC_DEFINE(HAVE_PT_CHOWN)
11 kx fi
11 kx
11 kx AC_ARG_ENABLE([tunables],
11 kx [AS_HELP_STRING([--enable-tunables],
11 kx [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
11 kx [have_tunables=$enableval],
11 kx [have_tunables=yes])
11 kx AC_SUBST(have_tunables)
11 kx if test "$have_tunables" = yes; then
11 kx AC_DEFINE(HAVE_TUNABLES)
11 kx fi
11 kx
11 kx # The abi-tags file uses a fairly simplistic model for name recognition that
11 kx # can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
11 kx # $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
11 kx # This doesn't get used much beyond that, so it's fairly safe.
11 kx case "$host_os" in
11 kx linux*)
11 kx ;;
11 kx gnu*)
11 kx host_os=`echo $host_os | sed -e 's/gnu/gnu-gnu/'`
11 kx ;;
11 kx esac
11 kx
11 kx AC_ARG_ENABLE([mathvec],
11 kx [AS_HELP_STRING([--enable-mathvec],
11 kx [Enable building and installing mathvec @<:@default depends on architecture@:>@])],
11 kx [build_mathvec=$enableval],
11 kx [build_mathvec=notset])
11 kx
11 kx AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
11 kx #ifndef __CET__
11 kx # error no CET compiler support
11 kx #endif]])],
11 kx [libc_cv_compiler_default_cet=yes],
11 kx [libc_cv_compiler_default_cet=no])
11 kx
11 kx AC_ARG_ENABLE([cet],
11 kx AS_HELP_STRING([--enable-cet],
11 kx [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
11 kx [enable_cet=$enableval],
11 kx [enable_cet=$libc_cv_compiler_default_cet])
11 kx
11 kx AC_ARG_ENABLE([scv],
11 kx AC_HELP_STRING([--disable-scv],
11 kx [syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
11 kx [use_scv=$enableval],
11 kx [use_scv=yes])
11 kx
11 kx AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
11 kx
11 kx # We keep the original values in `$config_*' and never modify them, so we
11 kx # can write them unchanged into config.make. Everything else uses
11 kx # $machine, $vendor, and $os, and changes them whenever convenient.
11 kx config_machine=$host_cpu config_vendor=$host_vendor config_os=$host_os
11 kx
11 kx # Don't allow vendor == "unknown"
11 kx test "$config_vendor" = unknown && config_vendor=
11 kx config_os="`echo $config_os | sed 's/^unknown-//'`"
11 kx
11 kx # Some configurations imply other options.
11 kx elf=yes
11 kx
11 kx # The configure fragment of a port can modify these to supplement
11 kx # or override the table in the case statement below. No fragment should
11 kx # ever change the config_* variables, however.
11 kx machine=$config_machine
11 kx vendor=$config_vendor
11 kx os=$config_os
11 kx base_os=''
11 kx
11 kx submachine=
11 kx AC_ARG_WITH([cpu],
11 kx AS_HELP_STRING([--with-cpu=CPU], [select code for CPU variant]),
11 kx [dnl
11 kx case "$withval" in
11 kx yes|'') AC_MSG_ERROR([--with-cpu requires an argument]) ;;
11 kx no) ;;
11 kx *) submachine="$withval" ;;
11 kx esac
11 kx ])
11 kx
11 kx # An preconfigure script can set this when it wants to disable the sanity
11 kx # check below.
11 kx libc_config_ok=no
11 kx
11 kx # A preconfigure script for a system that may or may not use fpu
11 kx # sysdeps directories sets this to a preprocessor conditional for
11 kx # whether to use such directories.
11 kx with_fp_cond=1
11 kx
11 kx dnl Let sysdeps/*/preconfigure act here.
11 kx LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
11 kx
11 kx
11 kx ###
11 kx ### By using the undocumented --enable-hacker-mode option for configure
11 kx ### one can skip this test to make the configuration not fail for unsupported
11 kx ### platforms.
11 kx ###
11 kx if test -z "$enable_hacker_mode" && test x"$libc_config_ok" != xyes; then
11 kx case "$machine-$host_os" in
11 kx *-linux* | *-gnu*)
11 kx ;;
11 kx *)
11 kx AC_MSG_ERROR([
11 kx *** The GNU C library is currently unavailable for this platform.
11 kx *** If you are interested in seeing glibc on this platform visit
11 kx *** the "How to submit a new port" in the wiki:
11 kx *** https://sourceware.org/glibc/wiki/#Development
11 kx *** and join the community!])
11 kx ;;
11 kx esac
11 kx fi
11 kx
11 kx # Set base_machine if not set by a preconfigure fragment.
11 kx test -n "$base_machine" || base_machine=$machine
11 kx AC_SUBST(base_machine)
11 kx
11 kx ### Locate tools.
11 kx
11 kx AC_PROG_INSTALL
11 kx if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
11 kx # The makefiles need to use a different form to find it in $srcdir.
11 kx INSTALL='\$(..)./scripts/install-sh -c'
11 kx fi
11 kx AC_PROG_LN_S
11 kx
11 kx LIBC_PROG_BINUTILS
11 kx
11 kx # Accept binutils 2.25 or newer.
11 kx libc_cv_with_lld=no
11 kx case $($LD --version) in
11 kx "GNU gold"*)
11 kx # Accept gold 1.14 or higher
11 kx AC_CHECK_PROG_VER(LD, $LD, --version,
11 kx [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
11 kx [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
11 kx LD=: critic_missing="$critic_missing GNU gold")
11 kx ;;
11 kx "LLD"*)
11 kx # Accept LLD 13.0.0 or higher
11 kx AC_CHECK_PROG_VER(LD, $LD, --version,
11 kx [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
11 kx [1[3-9].*|[2-9][0-9].*],
11 kx LD=: critic_missing="$critic_missing LLD")
11 kx libc_cv_with_lld=yes
11 kx ;;
11 kx *)
11 kx AC_CHECK_PROG_VER(LD, $LD, --version,
11 kx [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
11 kx [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
11 kx LD=: critic_missing="$critic_missing GNU ld")
11 kx ;;
11 kx esac
11 kx LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
11 kx
11 kx # These programs are version sensitive.
11 kx AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
11 kx [GNU Make[^0-9]*\([0-9][0-9.]*\)],
11 kx [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
11 kx
11 kx AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
11 kx [GNU gettext.* \([0-9]*\.[0-9.]*\)],
11 kx [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
11 kx MSGFMT=: aux_missing="$aux_missing msgfmt")
11 kx AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
11 kx [GNU texinfo.* \([0-9][0-9.]*\)],
11 kx [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
11 kx MAKEINFO=: aux_missing="$aux_missing makeinfo")
11 kx AC_CHECK_PROG_VER(SED, sed, --version,
11 kx [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
11 kx [3.0[2-9]*|3.[1-9]*|[4-9]*],
11 kx SED=: aux_missing="$aux_missing sed")
11 kx AC_CHECK_PROG_VER(AWK, gawk, --version,
11 kx [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
11 kx [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
11 kx AC_CHECK_PROG_VER(BISON, bison, --version,
11 kx [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
11 kx [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
11 kx
11 kx AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
11 kx AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
11 kx #if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
11 kx #error insufficient compiler
11 kx #endif]])],
11 kx [libc_cv_compiler_ok=yes],
11 kx [libc_cv_compiler_ok=no])])
11 kx AS_IF([test $libc_cv_compiler_ok != yes],
11 kx [critic_missing="$critic_missing compiler"])
11 kx
11 kx if test "x$maintainer" = "xyes"; then
11 kx AC_CHECK_PROGS(AUTOCONF, autoconf, no)
11 kx case "x$AUTOCONF" in
11 kx xno|x|x:) AUTOCONF=no ;;
11 kx *)
11 kx AC_CACHE_CHECK(dnl
11 kx whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
11 kx if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
11 kx libc_cv_autoconf_works=yes
11 kx else
11 kx libc_cv_autoconf_works=no
11 kx fi])
11 kx test $libc_cv_autoconf_works = yes || AUTOCONF=no
11 kx ;;
11 kx esac
11 kx if test "x$AUTOCONF" = xno; then
11 kx aux_missing="$aux_missing autoconf"
11 kx fi
11 kx else
11 kx AUTOCONF=no
11 kx fi
11 kx
11 kx # Check for python3 if available, or else python.
11 kx AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
11 kx [Python \([0-9][0-9.]*\)],
11 kx [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
11 kx critic_missing="$critic_missing python")
11 kx PYTHON="$PYTHON_PROG -B"
11 kx AC_SUBST(PYTHON)
11 kx
11 kx test -n "$critic_missing" && AC_MSG_ERROR([
11 kx *** These critical programs are missing or too old:$critic_missing
11 kx *** Check the INSTALL file for required versions.])
11 kx
11 kx test -n "$aux_missing" && AC_MSG_WARN([
11 kx *** These auxiliary programs are missing or incompatible versions:$aux_missing
11 kx *** some features or tests will be disabled.
11 kx *** Check the INSTALL file for required versions.])
11 kx
11 kx
11 kx # Determine whether to use fpu or nofpu sysdeps directories.
11 kx AC_CACHE_CHECK([for use of fpu sysdeps directories],
11 kx libc_cv_with_fp, [dnl
11 kx cat > conftest.c <<EOF
11 kx #if $with_fp_cond
11 kx int dummy;
11 kx #else
11 kx # error "no hardware floating point"
11 kx #endif
11 kx EOF
11 kx libc_cv_with_fp=no
11 kx if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
11 kx 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
11 kx libc_cv_with_fp=yes
11 kx fi
11 kx rm -f conftest*])
11 kx AC_SUBST(libc_cv_with_fp)
11 kx
11 kx AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
11 kx LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
11 kx [libc_cv_ssp=yes],
11 kx [libc_cv_ssp=no])
11 kx ])
11 kx
11 kx AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
11 kx LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
11 kx [libc_cv_ssp_strong=yes],
11 kx [libc_cv_ssp_strong=no])
11 kx ])
11 kx
11 kx AC_CACHE_CHECK(for -fstack-protector-all, libc_cv_ssp_all, [dnl
11 kx LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-all],
11 kx [libc_cv_ssp_all=yes],
11 kx [libc_cv_ssp_all=no])
11 kx ])
11 kx
11 kx stack_protector=
11 kx no_stack_protector=
11 kx if test "$libc_cv_ssp" = yes; then
11 kx no_stack_protector="-fno-stack-protector -DSTACK_PROTECTOR_LEVEL=0"
11 kx AC_DEFINE(HAVE_CC_NO_STACK_PROTECTOR)
11 kx fi
11 kx
11 kx if test "$enable_stack_protector" = yes && test "$libc_cv_ssp" = yes; then
11 kx stack_protector="-fstack-protector"
11 kx AC_DEFINE(STACK_PROTECTOR_LEVEL, 1)
11 kx elif test "$enable_stack_protector" = all && test "$libc_cv_ssp_all" = yes; then
11 kx stack_protector="-fstack-protector-all"
11 kx AC_DEFINE(STACK_PROTECTOR_LEVEL, 2)
11 kx elif test "$enable_stack_protector" = strong && test "$libc_cv_ssp_strong" = yes; then
11 kx stack_protector="-fstack-protector-strong"
11 kx AC_DEFINE(STACK_PROTECTOR_LEVEL, 3)
11 kx else
11 kx stack_protector="-fno-stack-protector"
11 kx AC_DEFINE(STACK_PROTECTOR_LEVEL, 0)
11 kx fi
11 kx AC_SUBST(libc_cv_ssp)
11 kx AC_SUBST(stack_protector)
11 kx AC_SUBST(no_stack_protector)
11 kx
11 kx if test -n "$stack_protector"; then
11 kx dnl Don't run configure tests with stack-protection on, to avoid problems with
11 kx dnl bootstrapping.
11 kx no_ssp=-fno-stack-protector
11 kx else
11 kx no_ssp=
11 kx
11 kx if test "$enable_stack_protector" != no; then
11 kx AC_MSG_ERROR([--enable-stack-protector=$enable_stack_protector specified, but specified level of stack protection is not supported by the compiler.])
11 kx fi
11 kx fi
11 kx
11 kx # For the multi-arch option we need support in the assembler & linker.
11 kx AC_CACHE_CHECK([for assembler and linker STT_GNU_IFUNC support],
11 kx libc_cv_ld_gnu_indirect_function, [dnl
11 kx cat > conftest.S <<EOF
11 kx .type foo,%gnu_indirect_function
11 kx foo:
11 kx .globl _start
11 kx _start:
11 kx .globl __start
11 kx __start:
11 kx .data
11 kx #ifdef _LP64
11 kx .quad foo
11 kx #else
11 kx .long foo
11 kx #endif
11 kx EOF
11 kx libc_cv_ld_gnu_indirect_function=no
11 kx if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
11 kx -nostartfiles -nostdlib $no_ssp \
11 kx -o conftest conftest.S 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
11 kx # Do a link to see if the backend supports IFUNC relocs.
11 kx $READELF -r conftest 1>&AS_MESSAGE_LOG_FD
11 kx LC_ALL=C $READELF -Wr conftest | grep -q 'IRELATIVE\|R_SPARC_JMP_IREL' && {
11 kx libc_cv_ld_gnu_indirect_function=yes
11 kx }
11 kx fi
11 kx rm -f conftest*])
11 kx
11 kx # Check if gcc supports attribute ifunc as it is used in libc_ifunc macro.
11 kx AC_CACHE_CHECK([for gcc attribute ifunc support],
11 kx libc_cv_gcc_indirect_function, [dnl
11 kx cat > conftest.c <<EOF
11 kx extern int func (int);
11 kx int used_func (int a)
11 kx {
11 kx return a;
11 kx }
11 kx static void *resolver ()
11 kx {
11 kx return &used_func;
11 kx }
11 kx extern __typeof (func) func __attribute__ ((ifunc ("resolver")));
11 kx EOF
11 kx libc_cv_gcc_indirect_function=no
11 kx if ${CC-cc} -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD \
11 kx 2>&AS_MESSAGE_LOG_FD ; then
11 kx if $READELF -s conftest.o | grep IFUNC >/dev/null 2>&AS_MESSAGE_LOG_FD; then
11 kx libc_cv_gcc_indirect_function=yes
11 kx fi
11 kx fi
11 kx rm -f conftest*])
11 kx
11 kx # Check if linker supports textrel relocation with ifunc (used on elf/tests).
11 kx # Note that it relies on libc_cv_ld_gnu_indirect_function test above.
11 kx AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
11 kx libc_cv_textrel_ifunc, [dnl
11 kx cat > conftest.S <<EOF
11 kx .type foo,%gnu_indirect_function
11 kx foo:
11 kx .globl _start
11 kx _start:
11 kx .globl __start
11 kx __start:
11 kx .data
11 kx #ifdef _LP64
11 kx .quad foo
11 kx #else
11 kx .long foo
11 kx #endif
11 kx .text
11 kx .globl address
11 kx address:
11 kx #ifdef _LP64
11 kx .quad address
11 kx #else
11 kx .long address
11 kx #endif
11 kx EOF
11 kx libc_cv_textrel_ifunc=no
11 kx if test $libc_cv_ld_gnu_indirect_function = yes; then
11 kx if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
11 kx libc_cv_textrel_ifunc=yes
11 kx fi
11 kx fi
11 kx rm -f conftest*])
11 kx AC_SUBST(libc_cv_textrel_ifunc)
11 kx
11 kx # Check if CC supports attribute retain as it is used in attribute_used_retain macro.
11 kx AC_CACHE_CHECK([for GNU attribute retain support],
11 kx libc_cv_gnu_retain, [dnl
11 kx cat > conftest.c <<EOF
11 kx static int var __attribute__ ((used, retain, section ("__libc_atexit")));
11 kx EOF
11 kx libc_cv_gnu_retain=no
11 kx if ${CC-cc} -Werror -c conftest.c -o /dev/null 1>&AS_MESSAGE_LOG_FD \
11 kx 2>&AS_MESSAGE_LOG_FD ; then
11 kx libc_cv_gnu_retain=yes
11 kx fi
11 kx rm -f conftest*])
11 kx if test $libc_cv_gnu_retain = yes; then
11 kx AC_DEFINE(HAVE_GNU_RETAIN)
11 kx fi
11 kx LIBC_CONFIG_VAR([have-gnu-retain], [$libc_cv_gnu_retain])
11 kx
11 kx # Check if gcc warns about alias for function with incompatible types.
11 kx AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
11 kx libc_cv_gcc_incompatible_alias, [dnl
11 kx cat > conftest.c <<EOF
11 kx int __redirect_foo (const void *s, int c);
11 kx
11 kx __typeof (__redirect_foo) *foo_impl (void) __asm__ ("foo");
11 kx __typeof (__redirect_foo) *foo_impl (void)
11 kx {
11 kx return 0;
11 kx }
11 kx
11 kx extern __typeof (__redirect_foo) foo_alias __attribute__ ((alias ("foo")));
11 kx EOF
11 kx libc_cv_gcc_incompatible_alias=yes
11 kx if ${CC-cc} -Werror -c conftest.c -o conftest.o 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
11 kx libc_cv_gcc_incompatible_alias=no
11 kx fi
11 kx rm -f conftest*])
11 kx
11 kx if test x"$libc_cv_ld_gnu_indirect_function" != xyes; then
11 kx if test x"$multi_arch" = xyes; then
11 kx AC_MSG_ERROR([--enable-multi-arch support requires assembler and linker support])
11 kx else
11 kx multi_arch=no
11 kx fi
11 kx fi
11 kx if test x"$libc_cv_gcc_indirect_function" != xyes; then
11 kx # GCC 8+ emits a warning for alias with incompatible types and it might
11 kx # fail to build ifunc resolvers aliases to either weak or internal
11 kx # symbols. Disables multiarch build in this case.
11 kx if test x"$libc_cv_gcc_incompatible_alias" = xyes; then
11 kx AC_MSG_WARN([gcc emits a warning for alias between functions of incompatible types])
11 kx if test x"$multi_arch" = xyes; then
11 kx AC_MSG_ERROR([--enable-multi-arch support requires a gcc with gnu-indirect-function support])
11 kx fi
11 kx AC_MSG_WARN([Multi-arch is disabled.])
11 kx multi_arch=no
11 kx elif test x"$multi_arch" = xyes; then
11 kx AC_MSG_WARN([--enable-multi-arch support recommends a gcc with gnu-indirect-function support.
11 kx Please use a gcc which supports it by default or configure gcc with --enable-gnu-indirect-function])
11 kx fi
11 kx fi
11 kx multi_arch_d=
11 kx if test x"$multi_arch" != xno; then
11 kx multi_arch_d=/multiarch
11 kx fi
11 kx
11 kx # Compute the list of sysdep directories for this configuration.
11 kx # This can take a while to compute.
11 kx sysdep_dir=$srcdir/sysdeps
11 kx AC_MSG_CHECKING(sysdep dirs)
11 kx dnl We need to use [ and ] for other purposes for a while now.
11 kx changequote(,)dnl
11 kx # Make sco3.2v4 become sco3.2.4 and sunos4.1.1_U1 become sunos4.1.1.U1.
11 kx os="`echo $os | sed 's/\([0-9A-Z]\)[v_]\([0-9A-Z]\)/\1.\2/g'`"
11 kx
11 kx test "x$base_os" != x || case "$os" in
11 kx gnu*)
11 kx base_os=mach/hurd ;;
11 kx linux*)
11 kx base_os=unix/sysv ;;
11 kx esac
11 kx
11 kx # For sunos4.1.1, try sunos4.1.1, then sunos4.1, then sunos4, then sunos.
11 kx tail=$os
11 kx ostry=$os
11 kx while o=`echo $tail | sed 's/\.[^.]*$//'`; test $o != $tail; do
11 kx ostry="$ostry /$o"
11 kx tail=$o
11 kx done
11 kx o=`echo $tail | sed 's/[0-9]*$//'`
11 kx if test $o != $tail; then
11 kx ostry="$ostry /$o"
11 kx fi
11 kx # For linux-gnu, try linux-gnu, then linux.
11 kx o=`echo $tail | sed 's/-.*$//'`
11 kx if test $o != $tail; then
11 kx ostry="$ostry /$o"
11 kx fi
11 kx
11 kx # For unix/sysv/sysv4, try unix/sysv/sysv4, then unix/sysv, then unix.
11 kx base=
11 kx tail=$base_os
11 kx while b=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$b"; do
11 kx set $b
11 kx base="$base /$1"
11 kx tail="$2"
11 kx done
11 kx
11 kx # For sparc/sparc32, try sparc/sparc32 and then sparc.
11 kx mach=
11 kx tail=$machine${submachine:+/$submachine}
11 kx while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
11 kx set $m
11 kx # Prepend the machine's FPU directory unless the architecture specific
11 kx # preconfigure disables it.
11 kx if test "$libc_cv_with_fp" = yes; then
11 kx maybe_fpu=/fpu
11 kx else
11 kx maybe_fpu=/nofpu
11 kx fi
11 kx # For each machine term, try it with and then without /multiarch.
11 kx for try_fpu in $maybe_fpu ''; do
11 kx for try_multi in $multi_arch_d ''; do
11 kx mach="$mach /$1$try_fpu$try_multi"
11 kx done
11 kx done
11 kx tail="$2"
11 kx done
11 kx
11 kx dnl We are done with glob and regexp uses of [ and ]; return to autoconf.
11 kx changequote([,])dnl
11 kx
11 kx # Find what sysdep directories exist.
11 kx sysnames=
11 kx for b in $base ''; do
11 kx for m0 in $mach ''; do
11 kx for v in /$vendor ''; do
11 kx test "$v" = / && continue
11 kx for o in /$ostry ''; do
11 kx test "$o" = / && continue
11 kx for m in $mach ''; do
11 kx try_suffix="$m0$b$v$o$m"
11 kx if test -n "$try_suffix"; then
11 kx try_srcdir="${srcdir}/"
11 kx try="sysdeps$try_suffix"
11 kx test -n "$enable_debug_configure" &&
11 kx echo "$0 [DEBUG]: try $try" >&2
11 kx if test -d "$try_srcdir$try"; then
11 kx sysnames="$sysnames $try"
11 kx { test -n "$o" || test -n "$b"; } && os_used=t
11 kx { test -n "$m" || test -n "$m0"; } && machine_used=t
11 kx case x${m0:-$m} in
11 kx x*/$submachine) submachine_used=t ;;
11 kx esac
11 kx fi
11 kx fi
11 kx done
11 kx done
11 kx done
11 kx done
11 kx done
11 kx
11 kx # If the assembler supports gnu_indirect_function symbol type and the
11 kx # architecture supports multi-arch, we enable multi-arch by default.
11 kx case $sysnames in
11 kx *"$multi_arch_d"*)
11 kx ;;
11 kx *)
11 kx test x"$multi_arch" = xdefault && multi_arch=no
11 kx ;;
11 kx esac
11 kx if test x"$multi_arch" != xno; then
11 kx AC_DEFINE(USE_MULTIARCH)
11 kx fi
11 kx AC_SUBST(multi_arch)
11 kx
11 kx if test -z "$os_used" && test "$os" != none; then
11 kx AC_MSG_ERROR(Operating system $os is not supported.)
11 kx fi
11 kx if test -z "$machine_used" && test "$machine" != none; then
11 kx AC_MSG_ERROR(The $machine is not supported.)
11 kx fi
11 kx if test -z "$submachine_used" && test -n "$submachine"; then
11 kx AC_MSG_ERROR(The $submachine subspecies of $host_cpu is not supported.)
11 kx fi
11 kx AC_SUBST(submachine)
11 kx
11 kx # We have now validated the configuration.
11 kx
11 kx # Expand the list of system names into a full list of directories
11 kx # from each element's parent name and Implies file (if present).
11 kx set $sysnames
11 kx names=
11 kx while test $# -gt 0; do
11 kx name=$1
11 kx shift
11 kx
11 kx case " $names " in *" $name "*)
11 kx # Already in the list.
11 kx continue
11 kx esac
11 kx
11 kx # Report each name as we discover it, so there is no long pause in output.
11 kx echo $ECHO_N "$name $ECHO_C" >&AS_MESSAGE_FD
11 kx
11 kx name_base=`echo $name | sed -e 's@\(.*sysdeps\)/.*@\1@'`
11 kx
11 kx case $name in
11 kx /*) xsrcdir= ;;
11 kx *) xsrcdir=$srcdir/ ;;
11 kx esac
11 kx test -n "$enable_debug_configure" &&
11 kx echo "[DEBUG]: name/Implies $xsrcdir$name/Implies" >&2
11 kx
11 kx for implies_file in Implies Implies-before Implies-after; do
11 kx implies_type=`echo $implies_file | sed s/-/_/`
11 kx eval ${implies_type}=
11 kx if test -f $xsrcdir$name/$implies_file; then
11 kx # Collect more names from the `Implies' file (removing comments).
11 kx implied_candidate="`sed 's/#.*$//' < $xsrcdir$name/$implies_file`"
11 kx for x in $implied_candidate; do
11 kx found=no
11 kx if test -d $xsrcdir$name_base/$x; then
11 kx eval "${implies_type}=\"\$${implies_type} \$name_base/\$x\""
11 kx found=yes
11 kx fi
11 kx try="sysdeps/$x"
11 kx try_srcdir=$srcdir/
11 kx test -n "$enable_debug_configure" &&
11 kx echo "[DEBUG]: $name $implies_file $x try() {$try_srcdir}$try" >&2
11 kx if test $try != $xsrcdir$name_base/$x && test -d $try_srcdir$try;
11 kx then
11 kx eval "${implies_type}=\"\$${implies_type} \$try\""
11 kx found=yes
11 kx fi
11 kx if test $found = no; then
11 kx AC_MSG_WARN($name/$implies_file specifies nonexistent $x)
11 kx fi
11 kx done
11 kx fi
11 kx done
11 kx
11 kx # Add NAME to the list of names.
11 kx names="$names $name"
11 kx
11 kx # Find the parent of NAME, using the empty string if it has none.
11 kx changequote(,)dnl
11 kx parent="`echo $name | sed -n -e 's=/[^/]*$==' -e '/sysdeps$/q' -e p`"
11 kx changequote([,])dnl
11 kx
11 kx test -n "$enable_debug_configure" &&
11 kx echo "[DEBUG]: $name Implies='$Implies' rest='$*' parent='$parent' \
11 kx Implies_before='$Implies_before' Implies_after='$Implies_after'" >&2
11 kx
11 kx # Add the names implied by NAME, and NAME's parent (if it has one), to
11 kx # the list of names to be processed (the argument list). We prepend the
11 kx # implied names to the list and append the parent. We want implied
11 kx # directories to come before further directories inferred from the
11 kx # configuration components; this ensures that for sysv4, unix/common
11 kx # (implied by unix/sysv/sysv4) comes before unix/sysv (in ostry (here $*)
11 kx # after sysv4).
11 kx sysnames="`echo $Implies $* $Implies_before $parent $Implies_after`"
11 kx test -n "$sysnames" && set $sysnames
11 kx done
11 kx
11 kx # Add the default directories.
11 kx default_sysnames="sysdeps/generic"
11 kx sysnames="$names $default_sysnames"
11 kx AC_SUBST(sysnames)
11 kx # The other names were emitted during the scan.
11 kx AC_MSG_RESULT($default_sysnames)
11 kx
11 kx # if using special system headers, find out the compiler's sekrit
11 kx # header directory and add that to the list. NOTE: Only does the right
11 kx # thing on a system that doesn't need fixincludes. (Not presently a problem.)
11 kx if test -n "$sysheaders"; then
11 kx SYSINCLUDES=-nostdinc
11 kx for d in include include-fixed; do
11 kx i=`$CC -print-file-name="$d"` && test "x$i" != x && test "x$i" != "x$d" &&
11 kx SYSINCLUDES="$SYSINCLUDES -isystem $i"
11 kx done
11 kx SYSINCLUDES="$SYSINCLUDES \
11 kx -isystem `echo $sysheaders | sed 's/:/ -isystem /g'`"
11 kx if test -n "$CXX"; then
11 kx CXX_SYSINCLUDES=
11 kx for cxxheaders in `$CXX -v -S -x c++ /dev/null -o /dev/null 2>&1 \
11 kx | sed -n -e '1,/#include/d' -e 's/^ \(\/.*\/[cg]++\)/\1/p'`; do
11 kx test "x$cxxheaders" != x &&
11 kx CXX_SYSINCLUDES="$CXX_SYSINCLUDES -isystem $cxxheaders"
11 kx done
11 kx fi
11 kx fi
11 kx AC_SUBST(SYSINCLUDES)
11 kx AC_SUBST(CXX_SYSINCLUDES)
11 kx
11 kx # Obtain some C++ header file paths. This is used to make a local
11 kx # copy of those headers in Makerules.
11 kx if test -n "$CXX"; then
11 kx find_cxx_header () {
11 kx echo "#include <$1>" | $CXX -H -fsyntax-only -x c++ - 2>&1 \
11 kx | $AWK '$1 == "."{print $2}'
11 kx }
11 kx CXX_CSTDLIB_HEADER="$(find_cxx_header cstdlib)"
11 kx CXX_CMATH_HEADER="$(find_cxx_header cmath)"
11 kx CXX_BITS_STD_ABS_H="$(find_cxx_header bits/std_abs.h)"
11 kx fi
11 kx AC_SUBST(CXX_CSTDLIB_HEADER)
11 kx AC_SUBST(CXX_CMATH_HEADER)
11 kx AC_SUBST(CXX_BITS_STD_ABS_H)
11 kx
11 kx # Test if LD_LIBRARY_PATH contains the notation for the current directory
11 kx # since this would lead to problems installing/building glibc.
11 kx # LD_LIBRARY_PATH contains the current directory if one of the following
11 kx # is true:
11 kx # - one of the terminals (":" and ";") is the first or last sign
11 kx # - two terminals occur directly after each other
11 kx # - the path contains an element with a dot in it
11 kx AC_MSG_CHECKING(LD_LIBRARY_PATH variable)
11 kx changequote(,)dnl
11 kx case ${LD_LIBRARY_PATH} in
11 kx [:\;]* | *[:\;] | *[:\;][:\;]* | *[:\;]. | .[:\;]*| . | *[:\;].[:\;]* )
11 kx ld_library_path_setting="contains current directory"
11 kx ;;
11 kx *)
11 kx ld_library_path_setting="ok"
11 kx ;;
11 kx esac
11 kx changequote([,])dnl
11 kx AC_MSG_RESULT($ld_library_path_setting)
11 kx if test "$ld_library_path_setting" != "ok"; then
11 kx AC_MSG_ERROR([
11 kx *** LD_LIBRARY_PATH shouldn't contain the current directory when
11 kx *** building glibc. Please change the environment variable
11 kx *** and run configure again.])
11 kx fi
11 kx
11 kx AC_PATH_PROG(BASH_SHELL, bash, no)
11 kx
11 kx AC_PATH_PROG(PERL, perl, no)
11 kx if test "$PERL" != no &&
11 kx (eval `$PERL -V:apiversion`; test `expr "$apiversion" \< 5` -ne 0); then
11 kx PERL=no
11 kx fi
11 kx AC_PATH_PROG(INSTALL_INFO, install-info, no,
11 kx $PATH:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin)
11 kx
11 kx AC_CACHE_CHECK(for .set assembler directive, libc_cv_asm_set_directive, [dnl
11 kx cat > conftest.s <<EOF
11 kx .text
11 kx foo:
11 kx .set glibc_conftest_frobozz,foo
11 kx .globl glibc_conftest_frobozz
11 kx EOF
11 kx # The alpha-dec-osf1 assembler gives only a warning for `.set'
11 kx # (but it doesn't work), so we must do a linking check to be sure.
11 kx cat > conftest1.c <<\EOF
11 kx extern int glibc_conftest_frobozz;
11 kx void _start() { glibc_conftest_frobozz = 1; }
11 kx EOF
11 kx if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS \
11 kx -nostartfiles -nostdlib $no_ssp \
11 kx -o conftest conftest.s conftest1.c 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD; then
11 kx libc_cv_asm_set_directive=yes
11 kx else
11 kx libc_cv_asm_set_directive=no
11 kx fi
11 kx rm -f conftest*])
11 kx if test $libc_cv_asm_set_directive = yes; then
11 kx AC_DEFINE(HAVE_ASM_SET_DIRECTIVE)
11 kx fi
11 kx
11 kx AC_CACHE_CHECK(linker support for protected data symbol,
11 kx libc_cv_protected_data,
11 kx [cat > conftest.c <<EOF
11 kx int bar __attribute__ ((visibility ("protected"))) = 1;
11 kx EOF
11 kx libc_cv_protected_data=no
11 kx if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -o conftest.so); then
11 kx cat > conftest.c <<EOF
11 kx extern int bar;
11 kx int main (void) { return bar; }
11 kx EOF
11 kx if AC_TRY_COMMAND(${CC-cc} -nostdlib -nostartfiles $no_ssp conftest.c -o conftest conftest.so); then
11 kx libc_cv_protected_data=yes
11 kx fi
11 kx fi
11 kx rm -f conftest.*
11 kx ])
11 kx AC_SUBST(libc_cv_protected_data)
11 kx
11 kx AC_CACHE_CHECK(linker support for INSERT in linker script,
11 kx libc_cv_insert,
11 kx [cat > conftest.c <<EOF
11 kx int __attribute__ ((section(".bar"))) bar = 0x12345678;
11 kx int test (void) { return bar; }
11 kx EOF
11 kx cat > conftest.t <<EOF
11 kx SECTIONS
11 kx {
11 kx .bar : { *(.bar) }
11 kx }
11 kx INSERT AFTER .rela.dyn;
11 kx EOF
11 kx libc_cv_insert=no
11 kx if AC_TRY_COMMAND([${CC-cc} -nostdlib -nostartfiles $no_ssp -fPIC -shared conftest.c -Wl,-T,conftest.t -o conftest.so]); then
11 kx libc_cv_insert=yes
11 kx fi
11 kx rm -f conftest.*
11 kx ])
11 kx AC_SUBST(libc_cv_insert)
11 kx
11 kx AC_CACHE_CHECK(for broken __attribute__((alias())),
11 kx libc_cv_broken_alias_attribute,
11 kx [cat > conftest.c <<EOF
11 kx extern int foo (int x) __asm ("xyzzy");
11 kx int bar (int x) { return x; }
11 kx extern __typeof (bar) foo __attribute ((weak, alias ("bar")));
11 kx extern int dfoo;
11 kx extern __typeof (dfoo) dfoo __asm ("abccb");
11 kx int dfoo = 1;
11 kx EOF
11 kx libc_cv_broken_alias_attribute=yes
11 kx if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then
11 kx if grep 'xyzzy' conftest.s >/dev/null &&
11 kx grep 'abccb' conftest.s >/dev/null; then
11 kx libc_cv_broken_alias_attribute=no
11 kx fi
11 kx fi
11 kx rm -f conftest.c conftest.s
11 kx ])
11 kx if test $libc_cv_broken_alias_attribute = yes; then
11 kx AC_MSG_ERROR(working alias attribute support required)
11 kx fi
11 kx
11 kx AC_CACHE_CHECK(whether to put _rtld_local into .sdata section,
11 kx libc_cv_have_sdata_section,
11 kx [echo "int i;" > conftest.c
11 kx libc_cv_have_sdata_section=no
11 kx if ${CC-cc} $LDFLAGS -fPIC -shared -Wl,--verbose conftest.c -o conftest.so 2>&1 \
11 kx | grep '\.sdata' >/dev/null; then
11 kx libc_cv_have_sdata_section=yes
11 kx fi
11 kx rm -f conftest.c conftest.so
11 kx ])
11 kx if test $libc_cv_have_sdata_section = yes; then
11 kx AC_DEFINE(HAVE_SDATA_SECTION)
11 kx fi
11 kx
11 kx AC_CACHE_CHECK(for libunwind-support in compiler,
11 kx libc_cv_cc_with_libunwind, [
11 kx cat > conftest.c <<EOF
11 kx int main (void) { return 0; }
11 kx EOF
11 kx if ${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -static -o conftest \
11 kx conftest.c -v 2>&1 >/dev/null | grep ' -lunwind ' >/dev/null; then
11 kx libc_cv_cc_with_libunwind=yes
11 kx else
11 kx libc_cv_cc_with_libunwind=no
11 kx fi
11 kx rm -f conftest*])
11 kx AC_SUBST(libc_cv_cc_with_libunwind)
11 kx if test $libc_cv_cc_with_libunwind = yes; then
11 kx AC_DEFINE(HAVE_CC_WITH_LIBUNWIND)
11 kx fi
11 kx
11 kx ASFLAGS_config=
11 kx AC_CACHE_CHECK(whether --noexecstack is desirable for .S files,
11 kx libc_cv_as_noexecstack, [dnl
11 kx cat > conftest.c <<EOF
11 kx void foo (void) { }
11 kx EOF
11 kx if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS
11 kx -S -o conftest.s conftest.c 1>&AS_MESSAGE_LOG_FD]) \
11 kx && grep .note.GNU-stack conftest.s >/dev/null \
11 kx && AC_TRY_COMMAND([${CC-cc} $ASFLAGS -Wa,--noexecstack
11 kx -c -o conftest.o conftest.s 1>&AS_MESSAGE_LOG_FD])
11 kx then
11 kx libc_cv_as_noexecstack=yes
11 kx else
11 kx libc_cv_as_noexecstack=no
11 kx fi
11 kx rm -f conftest*])
11 kx if test $libc_cv_as_noexecstack = yes; then
11 kx ASFLAGS_config="$ASFLAGS_config -Wa,--noexecstack"
11 kx fi
11 kx AC_SUBST(ASFLAGS_config)
11 kx
11 kx LIBC_LINKER_FEATURE([-z execstack], [-Wl,-z,execstack],
11 kx [libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
11 kx AC_SUBST(libc_cv_z_execstack)
11 kx
11 kx LIBC_LINKER_FEATURE([-z start-stop-gc], [-Wl,-z,start-stop-gc],
11 kx [libc_cv_z_start_stop_gc=yes], [libc_cv_z_start_stop_gc=no])
11 kx LIBC_CONFIG_VAR([have-z-start-stop-gc], [$libc_cv_z_start_stop_gc])
11 kx
11 kx LIBC_LINKER_FEATURE([--depaudit], [-Wl,--depaudit,x],
11 kx [libc_cv_depaudit=yes], [libc_cv_depaudit=no])
11 kx LIBC_CONFIG_VAR([have-depaudit], [$libc_cv_depaudit])
11 kx
11 kx LIBC_LINKER_FEATURE([-z pack-relative-relocs],
11 kx [-Wl,-z,pack-relative-relocs],
11 kx [libc_cv_dt_relr=yes], [libc_cv_dt_relr=no])
11 kx LIBC_CONFIG_VAR([have-dt-relr], [$libc_cv_dt_relr])
11 kx
11 kx LIBC_LINKER_FEATURE([--no-dynamic-linker],
11 kx [-Wl,--no-dynamic-linker],
11 kx [libc_cv_no_dynamic_linker=yes],
11 kx [libc_cv_no_dynamic_linker=no])
11 kx LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
11 kx
11 kx AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
11 kx LIBC_TRY_CC_OPTION([-static-pie],
11 kx [libc_cv_static_pie=yes],
11 kx [libc_cv_static_pie=no])
11 kx ])
11 kx LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
11 kx
11 kx AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
11 kx LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
11 kx ])
11 kx
11 kx AC_SUBST(libc_cv_fpie)
11 kx
11 kx AC_CACHE_CHECK(for --hash-style option,
11 kx libc_cv_hashstyle, [dnl
11 kx cat > conftest.c <<EOF
11 kx int _start (void) { return 42; }
11 kx EOF
11 kx if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS $no_ssp
11 kx -fPIC -shared -o conftest.so conftest.c
11 kx -Wl,--hash-style=both -nostdlib 1>&AS_MESSAGE_LOG_FD])
11 kx then
11 kx libc_cv_hashstyle=yes
11 kx else
11 kx libc_cv_hashstyle=no
11 kx fi
11 kx rm -f conftest*])
11 kx AC_SUBST(libc_cv_hashstyle)
11 kx
11 kx AC_CACHE_CHECK(for GLOB_DAT reloc,
11 kx libc_cv_has_glob_dat, [dnl
11 kx cat > conftest.c <<EOF
11 kx extern int mumble;
11 kx int foo (void) { return mumble; }
11 kx EOF
11 kx if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS
11 kx -fPIC -shared -o conftest.so conftest.c
11 kx -nostdlib -nostartfiles $no_ssp
11 kx 1>&AS_MESSAGE_LOG_FD])
11 kx then
11 kx dnl look for GLOB_DAT relocation.
11 kx if $READELF -rW conftest.so | grep '_GLOB_DAT' > /dev/null; then
11 kx libc_cv_has_glob_dat=yes
11 kx else
11 kx libc_cv_has_glob_dat=no
11 kx fi
11 kx else
11 kx libc_cv_has_glob_dat=no
11 kx fi
11 kx rm -f conftest*])
11 kx AC_SUBST(libc_cv_has_glob_dat)
11 kx
11 kx AC_CACHE_CHECK([for -mtls-dialect=gnu2], libc_cv_mtls_dialect_gnu2,
11 kx [dnl
11 kx cat > conftest.c <<EOF
11 kx __thread int i;
11 kx void foo (void)
11 kx {
11 kx i = 10;
11 kx }
11 kx EOF
11 kx if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -fPIC -mtls-dialect=gnu2 -nostdlib -nostartfiles
11 kx conftest.c -o conftest 1>&AS_MESSAGE_LOG_FD])
11 kx then
11 kx libc_cv_mtls_dialect_gnu2=yes
11 kx else
11 kx libc_cv_mtls_dialect_gnu2=no
11 kx fi
11 kx rm -f conftest*])
11 kx AC_SUBST(libc_cv_mtls_dialect_gnu2)
11 kx LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
11 kx
11 kx dnl clang emits an warning for a double alias redirection, to warn the
11 kx dnl original symbol is sed even when weak definition overriddes it.
11 kx dnl It is a usual pattern for weak_alias, where multiple alias point to
11 kx dnl same symbol.
11 kx AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
11 kx libc_cv_wno_ignored_attributes, [dnl
11 kx cat > conftest.c <<EOF
11 kx void __foo (void)
11 kx {
11 kx }
11 kx extern __typeof (__foo) foo __attribute__ ((weak, alias ("__foo")));
11 kx extern __typeof (__foo) bar __attribute__ ((weak, alias ("foo")));
11 kx EOF
11 kx libc_cv_wno_ignored_attributes=""
11 kx if ! AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -Werror -c conftest.c])
11 kx then
11 kx libc_cv_wno_ignored_attributes="-Wno-ignored-attributes"
11 kx fi
11 kx rm -f conftest*])
11 kx LIBC_CONFIG_VAR([config-cflags-wno-ignored-attributes],
11 kx [$libc_cv_wno_ignored_attributes])
11 kx
11 kx AC_CACHE_CHECK(whether cc puts quotes around section names,
11 kx libc_cv_have_section_quotes,
11 kx [cat > conftest.c <<EOF
11 kx static const int foo
11 kx __attribute__ ((section ("bar"))) = 1;
11 kx EOF
11 kx if ${CC-cc} -S conftest.c -o conftest.s; then
11 kx if grep '\.section.*"bar"' conftest.s >/dev/null; then
11 kx libc_cv_have_section_quotes=yes
11 kx else
11 kx libc_cv_have_section_quotes=no
11 kx fi
11 kx else
11 kx libc_cv_have_section_quotes=unknown
11 kx fi
11 kx rm -f conftest.{c,s}
11 kx ])
11 kx if test $libc_cv_have_section_quotes = yes; then
11 kx AC_DEFINE(HAVE_SECTION_QUOTES)
11 kx fi
11 kx
11 kx AC_CACHE_CHECK(for __builtin_memset, libc_cv_gcc_builtin_memset, [dnl
11 kx cat > conftest.c <<\EOF
11 kx void zero (void *x)
11 kx {
11 kx __builtin_memset (x, 0, 1000);
11 kx }
11 kx EOF
11 kx dnl
11 kx if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "memset" > /dev/null]);
11 kx then
11 kx libc_cv_gcc_builtin_memset=no
11 kx else
11 kx libc_cv_gcc_builtin_memset=yes
11 kx fi
11 kx rm -f conftest* ])
11 kx if test "$libc_cv_gcc_builtin_memset" = yes ; then
11 kx AC_DEFINE(HAVE_BUILTIN_MEMSET)
11 kx fi
11 kx
11 kx AC_CACHE_CHECK(for redirection of built-in functions, libc_cv_gcc_builtin_redirection, [dnl
11 kx cat > conftest.c <<\EOF
11 kx extern char *strstr (const char *, const char *) __asm ("my_strstr");
11 kx char *foo (const char *a, const char *b)
11 kx {
11 kx return __builtin_strstr (a, b);
11 kx }
11 kx EOF
11 kx dnl
11 kx if AC_TRY_COMMAND([${CC-cc} -O3 -S conftest.c -o - | grep -F "my_strstr" > /dev/null]);
11 kx then
11 kx libc_cv_gcc_builtin_redirection=yes
11 kx else
11 kx libc_cv_gcc_builtin_redirection=no
11 kx fi
11 kx rm -f conftest* ])
11 kx if test "$libc_cv_gcc_builtin_redirection" = no; then
11 kx AC_MSG_ERROR([support for the symbol redirection needed])
11 kx fi
11 kx
11 kx dnl Determine how to disable generation of FMA instructions.
11 kx AC_CACHE_CHECK([for compiler option to disable generation of FMA instructions],
11 kx libc_cv_cc_nofma, [dnl
11 kx libc_cv_cc_nofma=
11 kx for opt in -ffp-contract=off -mno-fused-madd; do
11 kx LIBC_TRY_CC_OPTION([$opt], [libc_cv_cc_nofma=$opt; break])
11 kx done])
11 kx AC_SUBST(libc_cv_cc_nofma)
11 kx
11 kx if test -n "$submachine"; then
11 kx AC_CACHE_CHECK([for compiler option for CPU variant],
11 kx libc_cv_cc_submachine, [dnl
11 kx libc_cv_cc_submachine=no
11 kx for opt in "-march=$submachine" "-mcpu=$submachine"; do
11 kx LIBC_TRY_CC_OPTION([$opt], [
11 kx libc_cv_cc_submachine="$opt"
11 kx break], [])
11 kx done])
11 kx if test "x$libc_cv_cc_submachine" = xno; then
11 kx AC_MSG_ERROR([${CC-cc} does not support $submachine])
11 kx fi
11 kx fi
11 kx AC_SUBST(libc_cv_cc_submachine)
11 kx
11 kx dnl Determine if compiler supports -fsignaling-nans
11 kx AC_CACHE_CHECK([for compiler option that -fsignaling-nans],
11 kx libc_cv_cc_signaling_nans, [dnl
11 kx LIBC_TRY_CC_OPTION([-Werror -fsignaling-nans],
11 kx [libc_cv_cc_signaling_nans=-fsignaling-nans],
11 kx [libc_cv_cc_signaling_nans=])
11 kx ])
11 kx LIBC_CONFIG_VAR([config-cflags-signaling-nans],
11 kx [$libc_cv_cc_signaling_nans])
11 kx
11 kx AC_CACHE_CHECK(if $CC accepts -fno-tree-loop-distribute-patterns with \
11 kx __attribute__ ((__optimize__)), libc_cv_cc_loop_to_function, [dnl
11 kx cat > conftest.c <<EOF
11 kx void
11 kx __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
11 kx foo (void) {}
11 kx EOF
11 kx libc_cv_cc_loop_to_function=no
11 kx if AC_TRY_COMMAND([${CC-cc} $CFLAGS $CPPFLAGS -c conftest.c])
11 kx then
11 kx libc_cv_cc_loop_to_function=yes
11 kx fi
11 kx rm -f conftest*])
11 kx if test $libc_cv_cc_loop_to_function = yes; then
11 kx AC_DEFINE(HAVE_CC_INHIBIT_LOOP_TO_LIBCALL)
11 kx fi
11 kx AC_SUBST(libc_cv_cc_loop_to_function)
11 kx
11 kx dnl Check whether we have the gd library available.
11 kx AC_MSG_CHECKING(for libgd)
11 kx if test "$with_gd" != "no"; then
11 kx old_CFLAGS="$CFLAGS"
11 kx CFLAGS="$CFLAGS $libgd_include"
11 kx old_LDFLAGS="$LDFLAGS"
11 kx LDFLAGS="$LDFLAGS $libgd_ldflags"
11 kx old_LIBS="$LIBS"
11 kx LIBS="$LIBS -lgd -lpng -lz -lm"
11 kx AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <gd.h>]], [[gdImagePng (0, 0)]])],
11 kx [LIBGD=yes], [LIBGD=no])
11 kx CFLAGS="$old_CFLAGS"
11 kx LDFLAGS="$old_LDFLAGS"
11 kx LIBS="$old_LIBS"
11 kx else
11 kx LIBGD=no
11 kx fi
11 kx AC_MSG_RESULT($LIBGD)
11 kx AC_SUBST(LIBGD)
11 kx
11 kx # SELinux detection
11 kx if test x$with_selinux = xno ; then
11 kx have_selinux=no;
11 kx else
11 kx # See if we have the SELinux library
11 kx AC_CHECK_LIB(selinux, is_selinux_enabled,
11 kx have_selinux=yes, have_selinux=no)
11 kx if test x$with_selinux = xyes ; then
11 kx if test x$have_selinux = xno ; then
11 kx AC_MSG_ERROR([SELinux explicitly required, but SELinux library not found])
11 kx fi
11 kx fi
11 kx fi
11 kx # Check if we're building with SELinux support.
11 kx if test "x$have_selinux" = xyes; then
11 kx AC_DEFINE(HAVE_SELINUX, 1, [SELinux support])
11 kx
11 kx # See if we have the libaudit library
11 kx AC_CHECK_LIB(audit, audit_log_user_avc_message,
11 kx have_libaudit=yes, have_libaudit=no)
11 kx if test "x$have_libaudit" = xyes; then
11 kx AC_DEFINE(HAVE_LIBAUDIT, 1, [SELinux libaudit support])
11 kx fi
11 kx AC_SUBST(have_libaudit)
11 kx
11 kx # See if we have the libcap library
11 kx AC_CHECK_LIB(cap, cap_init, have_libcap=yes, have_libcap=no)
11 kx if test "x$have_libcap" = xyes; then
11 kx AC_DEFINE(HAVE_LIBCAP, 1, [SELinux libcap support])
11 kx fi
11 kx AC_SUBST(have_libcap)
11 kx fi
11 kx AC_SUBST(have_selinux)
11 kx
11 kx CPPUNDEFS=
11 kx dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
11 kx dnl Since we are building the implementations of the fortified functions here,
11 kx dnl having the macro defined interacts very badly.
11 kx dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
11 kx dnl and above (see "man FEATURE_TEST_MACROS").
11 kx dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
11 kx AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
11 kx [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
11 kx #ifdef _FORTIFY_SOURCE
11 kx # error bogon
11 kx #endif]])],
11 kx [libc_cv_predef_fortify_source=no],
11 kx [libc_cv_predef_fortify_source=yes])])
11 kx if test $libc_cv_predef_fortify_source = yes; then
11 kx CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
11 kx fi
11 kx AC_SUBST(CPPUNDEFS)
11 kx
11 kx dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
11 kx dnl to one symbol (PR 23840).
11 kx AC_CACHE_CHECK(whether the assembler requires one version per symbol,
11 kx libc_cv_symver_needs_alias, [dnl
11 kx cat > conftest.s <<EOF
11 kx .text
11 kx testfunc:
11 kx .globl testfunc
11 kx .symver testfunc, testfunc1@VERSION1
11 kx .symver testfunc, testfunc1@VERSION2
11 kx EOF
11 kx libc_cv_symver_needs_alias=no
11 kx if ${CC-cc} $ASFLAGS -c conftest.s 2>&AS_MESSAGE_LOG_FD; then
11 kx libc_cv_symver_needs_alias=no
11 kx else
11 kx libc_cv_symver_needs_alias=yes
11 kx fi
11 kx rm conftest.*
11 kx ])
11 kx if test "$libc_cv_symver_needs_alias" = yes; then
11 kx AC_DEFINE(SYMVER_NEEDS_ALIAS)
11 kx fi
11 kx
11 kx AC_CACHE_CHECK(for __builtin_trap with no external dependencies,
11 kx libc_cv_builtin_trap, [dnl
11 kx libc_cv_builtin_trap=no
11 kx AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[__builtin_trap ()]])],[
11 kx libc_undefs=`$NM -u conftest.o |
11 kx LC_ALL=C $AWK '$1 == "U" { print $2 | "sort -u"; next } { exit(1) }' \
11 kx 2>&AS_MESSAGE_LOG_FD` || {
11 kx AC_MSG_ERROR([confusing output from $NM -u])
11 kx }
11 kx echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
11 kx if test -z "$libc_undefs"; then
11 kx libc_cv_builtin_trap=yes
11 kx fi],[])])
11 kx if test $libc_cv_builtin_trap = yes; then
11 kx AC_DEFINE([HAVE_BUILTIN_TRAP])
11 kx fi
11 kx
11 kx dnl C++ feature tests.
11 kx AC_LANG_PUSH([C++])
11 kx
11 kx AC_CACHE_CHECK([whether the C++ compiler supports thread_local],
11 kx libc_cv_cxx_thread_local, [
11 kx old_CXXFLAGS="$CXXFLAGS"
11 kx CXXFLAGS="$CXXFLAGS -std=gnu++11"
11 kx AC_COMPILE_IFELSE([AC_LANG_SOURCE([
11 kx #include <thread>
11 kx
11 kx // Compiler support.
11 kx struct S
11 kx {
11 kx S ();
11 kx ~S ();
11 kx };
11 kx thread_local S s;
11 kx S * get () { return &s; }
11 kx
11 kx // libstdc++ support.
11 kx #ifndef _GLIBCXX_HAVE___CXA_THREAD_ATEXIT_IMPL
11 kx #error __cxa_thread_atexit_impl not supported
11 kx #endif
11 kx ])],
11 kx [libc_cv_cxx_thread_local=yes],
11 kx [libc_cv_cxx_thread_local=no])
11 kx CXXFLAGS="$old_CXXFLAGS"
11 kx ])
11 kx AC_SUBST(libc_cv_cxx_thread_local)
11 kx
11 kx AC_LANG_POP([C++])
11 kx dnl End of C++ feature tests.
11 kx
11 kx ### End of automated tests.
11 kx ### Now run sysdeps configure fragments.
11 kx
11 kx # They also can set these variables.
11 kx use_ldconfig=no
11 kx ldd_rewrite_script=no
11 kx libc_cv_sysconfdir=$sysconfdir
11 kx libc_cv_localstatedir=$localstatedir
11 kx libc_cv_gcc_unwind_find_fde=no
11 kx libc_cv_idn=no
11 kx pthread_in_libc=yes
11 kx
11 kx # Iterate over all the sysdep directories we will use, running their
11 kx # configure fragments.
11 kx for dir in $sysnames; do
11 kx case $dir in
11 kx /*) dest=$dir ;;
11 kx *) dest=$srcdir/$dir ;;
11 kx esac
11 kx if test -r $dest/configure; then
11 kx AC_MSG_RESULT(running configure fragment for $dir)
11 kx . $dest/configure
11 kx fi
11 kx done
11 kx
11 kx if test x"$build_mathvec" = xnotset; then
11 kx build_mathvec=no
11 kx fi
11 kx LIBC_CONFIG_VAR([build-mathvec], [$build_mathvec])
11 kx
11 kx AC_SUBST(libc_extra_cflags)
11 kx AC_SUBST(libc_extra_cppflags)
11 kx
11 kx if test x$libc_cv_gcc_unwind_find_fde = xyes; then
11 kx AC_DEFINE(EXPORT_UNWIND_FIND_FDE)
11 kx fi
11 kx AC_SUBST(libc_cv_gcc_unwind_find_fde)
11 kx
11 kx # A sysdeps configure fragment can reset this if IFUNC is not actually
11 kx # usable even though the assembler knows how to generate the symbol type.
11 kx if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
11 kx AC_DEFINE(HAVE_IFUNC)
11 kx fi
11 kx LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
11 kx
11 kx if test x"$libc_cv_gcc_indirect_function" = xyes; then
11 kx AC_DEFINE(HAVE_GCC_IFUNC)
11 kx fi
11 kx LIBC_CONFIG_VAR([have-gcc-ifunc], [$libc_cv_gcc_indirect_function])
11 kx
11 kx # This is far from the AC_ARG_ENABLE that sets it so that a sysdeps
11 kx # configure fragment can override the value to prevent this AC_DEFINE.
11 kx AC_SUBST(use_nscd)
11 kx if test "x$use_nscd" != xno; then
11 kx AC_DEFINE([USE_NSCD])
11 kx fi
11 kx if test "x$build_nscd" = xdefault; then
11 kx build_nscd=$use_nscd
11 kx fi
11 kx
11 kx AC_SUBST(libc_cv_slibdir)
11 kx AC_SUBST(libc_cv_rtlddir)
11 kx AC_SUBST(libc_cv_complocaledir)
11 kx AC_SUBST(libc_cv_sysconfdir)
11 kx AC_SUBST(libc_cv_localstatedir)
11 kx AC_SUBST(libc_cv_rootsbindir)
11 kx
11 kx if test x$use_ldconfig = xyes; then
11 kx AC_DEFINE(USE_LDCONFIG)
11 kx fi
11 kx AC_SUBST(use_ldconfig)
11 kx AC_SUBST(ldd_rewrite_script)
11 kx
11 kx AC_SUBST(static)
11 kx AC_SUBST(shared)
11 kx
11 kx AC_CACHE_CHECK([whether -fPIC is default], libc_cv_pic_default,
11 kx [libc_cv_pic_default=yes
11 kx cat > conftest.c <<EOF
11 kx #if defined __PIC__ || defined __pic__ || defined PIC || defined pic
11 kx # error PIC is default.
11 kx #endif
11 kx EOF
11 kx if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
11 kx libc_cv_pic_default=no
11 kx fi
11 kx rm -f conftest.*])
11 kx LIBC_CONFIG_VAR([build-pic-default], [$libc_cv_pic_default])
11 kx
11 kx AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
11 kx [libc_cv_cc_pie_default=yes
11 kx cat > conftest.c <<EOF
11 kx #if defined __PIE__ || defined __pie__ || defined PIE || defined pie
11 kx # error PIE is default.
11 kx #endif
11 kx EOF
11 kx if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
11 kx libc_cv_cc_pie_default=no
11 kx fi
11 kx rm -f conftest.*])
11 kx LIBC_CONFIG_VAR([cc-pie-default], [$libc_cv_cc_pie_default])
11 kx
11 kx AC_MSG_CHECKING(if we can build programs as PIE)
11 kx AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifdef PIE_UNSUPPORTED
11 kx # error PIE is not supported
11 kx #endif]])], [libc_cv_pie_supported=yes], [libc_cv_pie_supported=no])
11 kx AC_MSG_RESULT($libc_cv_pie_supported)
11 kx # Disable build-pie-default if target does not support it or glibc is
11 kx # configured with --disable-default-pie.
11 kx if test "x$default_pie" = xno; then
11 kx build_pie_default=no
11 kx else
11 kx build_pie_default=$libc_cv_pie_supported
11 kx fi
11 kx LIBC_CONFIG_VAR([build-pie-default], [$build_pie_default])
11 kx
11 kx AC_MSG_CHECKING(if we can build static PIE programs)
11 kx libc_cv_static_pie_supported=$libc_cv_pie_supported
11 kx if test "x$libc_cv_pie_supported" != xno \
11 kx -a "$libc_cv_no_dynamic_linker" = yes; then
11 kx AC_COMPILE_IFELSE([AC_LANG_SOURCE([[#ifndef SUPPORT_STATIC_PIE
11 kx # error static PIE is not supported
11 kx #endif]])], [libc_cv_static_pie_supported=yes],
11 kx [libc_cv_static_pie_supported=no])
11 kx fi
11 kx AC_MSG_RESULT($libc_cv_static_pie_supported)
11 kx
11 kx # Enable static-pie only if it is available and glibc isn't configured
11 kx # with --disable-default-pie.
11 kx if test "x$default_pie" = xno; then
11 kx libc_cv_static_pie=no
11 kx else
11 kx libc_cv_static_pie=$libc_cv_static_pie_supported
11 kx fi
11 kx if test "$libc_cv_static_pie" = "yes"; then
11 kx AC_DEFINE(ENABLE_STATIC_PIE)
11 kx fi
11 kx LIBC_CONFIG_VAR([enable-static-pie], [$libc_cv_static_pie])
11 kx
11 kx # Set the `multidir' variable by grabbing the variable from the compiler.
11 kx # We do it once and save the result in a generated makefile.
11 kx libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
11 kx AC_SUBST(libc_cv_multidir)
11 kx
11 kx AC_SUBST(profile)
11 kx AC_SUBST(static_nss)
11 kx
11 kx AC_SUBST(DEFINES)
11 kx
11 kx dnl See sysdeps/mach/configure.ac for this variable.
11 kx AC_SUBST(mach_interface_list)
11 kx
11 kx VERSION=`sed -n -e 's/^#define VERSION "\([^"]*\)"/\1/p' < $srcdir/version.h`
11 kx RELEASE=`sed -n -e 's/^#define RELEASE "\([^"]*\)"/\1/p' < $srcdir/version.h`
11 kx AC_SUBST(VERSION)
11 kx AC_SUBST(RELEASE)
11 kx
11 kx if test "$pthread_in_libc" = yes; then
11 kx AC_DEFINE(PTHREAD_IN_LIBC)
11 kx fi
11 kx AC_SUBST(pthread_in_libc)
11 kx
11 kx AC_CONFIG_FILES([config.make Makefile])
11 kx AC_CONFIG_COMMANDS([default],[[
11 kx case $CONFIG_FILES in *config.make*)
11 kx echo "$config_vars" >> config.make;;
11 kx esac
11 kx test -d bits || mkdir bits]],[[config_vars='$config_vars']])
11 kx AC_OUTPUT