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