fi
AC_SUBST(cross_compiling)
AC_PROG_CPP
-AC_CHECK_TOOL(READELF, readelf, false)
-AC_CHECK_TOOL(OBJDUMP, objdump, false)
# We need the C++ compiler only for testing.
AC_PROG_CXX
[sysheaders=''])
AC_SUBST(sysheaders)
-AC_SUBST(use_default_link)
-AC_ARG_WITH([default-link],
- AS_HELP_STRING([--with-default-link],
- [do not use explicit linker scripts]),
- [use_default_link=$withval],
- [use_default_link=no])
-
dnl Additional build flags injection.
AC_ARG_WITH([nonshared-cflags],
AS_HELP_STRING([--with-nonshared-cflags=CFLAGS],
[enable_stack_protector=no])
case "$enable_stack_protector" in
all|yes|no|strong) ;;
-*) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: \"$enable_stack_protector\"]);;
+*) AC_MSG_ERROR([Not a valid argument for --enable-stack-protector: "$enable_stack_protector"]);;
esac
dnl On some platforms we cannot use dynamic loading. We must provide
[multi_arch=$enableval],
[multi_arch=default])
-AC_ARG_ENABLE([experimental-malloc],
- AS_HELP_STRING([--disable-experimental-malloc],
- [disable experimental malloc features]),
- [experimental_malloc=$enableval],
- [experimental_malloc=yes])
-AC_SUBST(experimental_malloc)
-
AC_ARG_ENABLE([memory-tagging],
AS_HELP_STRING([--enable-memory-tagging],
[enable memory tagging if supported by the architecture @<:@default=no@:>@]),
AC_DEFINE(HAVE_PT_CHOWN)
fi
-AC_ARG_ENABLE([tunables],
- [AS_HELP_STRING([--enable-tunables],
- [Enable tunables support. Known values are 'yes', 'no' and 'valstring'])],
- [have_tunables=$enableval],
- [have_tunables=yes])
-AC_SUBST(have_tunables)
-if test "$have_tunables" = yes; then
- AC_DEFINE(HAVE_TUNABLES)
-fi
-
# The abi-tags file uses a fairly simplistic model for name recognition that
# can't distinguish i486-pc-linux-gnu fully from i486-pc-gnu. So we mutate a
# $host_os of `gnu*' here to be `gnu-gnu*' just so that it can tell.
[enable_cet=$libc_cv_compiler_default_cet])
AC_ARG_ENABLE([scv],
- AC_HELP_STRING([--disable-scv],
+ AS_HELP_STRING([--disable-scv],
[syscalls will not use scv instruction, even if the kernel supports it, powerpc only]),
[use_scv=$enableval],
[use_scv=yes])
AS_IF([[test "$use_scv" != "no"]],[AC_DEFINE(USE_PPC_SCV)])
+dnl Build glibc with _FORTIFY_SOURCE
+AC_ARG_ENABLE(fortify-source,
+ AS_HELP_STRING([--enable-fortify-source@<:@=1|2|3@:>@],
+ [Use -D_FORTIFY_SOURCE=[1|2|3] to control code hardening, defaults to highest possible value supported by the build compiler.]),
+ [enable_fortify_source=$enableval],
+ [enable_fortify_source=no])
+case "$enable_fortify_source" in
+1|2|3|no|yes) ;;
+*) AC_MSG_ERROR([Not a valid argument for --enable-fortify-source: "$enable_fortify_source"]);;
+esac
+
# We keep the original values in `$config_*' and never modify them, so we
# can write them unchanged into config.make. Everything else uses
# $machine, $vendor, and $os, and changes them whenever convenient.
test -n "$base_machine" || base_machine=$machine
AC_SUBST(base_machine)
+### Locate tools.
+
+AC_PROG_INSTALL
+if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
+ # The makefiles need to use a different form to find it in $srcdir.
+ INSTALL='\$(..)./scripts/install-sh -c'
+fi
+AC_PROG_LN_S
+
+LIBC_PROG_BINUTILS
+
+# Accept binutils 2.25 or newer.
+libc_cv_with_lld=no
+case $($LD --version) in
+ "GNU gold"*)
+ # Accept gold 1.14 or higher
+ AC_CHECK_PROG_VER(LD, $LD, --version,
+ [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
+ [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
+ LD=: critic_missing="$critic_missing GNU gold")
+ ;;
+ "LLD"*)
+ # Accept LLD 13.0.0 or higher
+ AC_CHECK_PROG_VER(LD, $LD, --version,
+ [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
+ [1[3-9].*|[2-9][0-9].*],
+ LD=: critic_missing="$critic_missing LLD")
+ libc_cv_with_lld=yes
+ ;;
+ *)
+ AC_CHECK_PROG_VER(LD, $LD, --version,
+ [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
+ [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
+ LD=: critic_missing="$critic_missing GNU ld")
+ ;;
+esac
+LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
+
+# These programs are version sensitive.
+AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
+ [GNU Make[^0-9]*\([0-9][0-9.]*\)],
+ [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+
+AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
+ [GNU gettext.* \([0-9]*\.[0-9.]*\)],
+ [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
+ MSGFMT=: aux_missing="$aux_missing msgfmt")
+AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
+ [GNU texinfo.* \([0-9][0-9.]*\)],
+ [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
+ MAKEINFO=: aux_missing="$aux_missing makeinfo")
+AC_CHECK_PROG_VER(SED, sed, --version,
+ [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
+ [3.0[2-9]*|3.[1-9]*|[4-9]*],
+ SED=: aux_missing="$aux_missing sed")
+AC_CHECK_PROG_VER(AWK, gawk, --version,
+ [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
+ [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
+AC_CHECK_PROG_VER(BISON, bison, --version,
+ [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
+ [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
+
+AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
+AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
+#if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
+#error insufficient compiler
+#endif]])],
+ [libc_cv_compiler_ok=yes],
+ [libc_cv_compiler_ok=no])])
+AS_IF([test $libc_cv_compiler_ok != yes],
+ [critic_missing="$critic_missing compiler"])
+
+if test "x$maintainer" = "xyes"; then
+ AC_CHECK_PROGS(AUTOCONF, autoconf, no)
+ case "x$AUTOCONF" in
+ xno|x|x:) AUTOCONF=no ;;
+ *)
+ AC_CACHE_CHECK(dnl
+ whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
+ if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
+ libc_cv_autoconf_works=yes
+ else
+ libc_cv_autoconf_works=no
+ fi])
+ test $libc_cv_autoconf_works = yes || AUTOCONF=no
+ ;;
+ esac
+ if test "x$AUTOCONF" = xno; then
+ aux_missing="$aux_missing autoconf"
+ fi
+else
+ AUTOCONF=no
+fi
+
+# Check for python3 if available, or else python.
+AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
+ [Python \([0-9][0-9.]*\)],
+ [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
+ critic_missing="$critic_missing python")
+PYTHON="$PYTHON_PROG -B"
+AC_SUBST(PYTHON)
+
+test -n "$critic_missing" && AC_MSG_ERROR([
+*** These critical programs are missing or too old:$critic_missing
+*** Check the INSTALL file for required versions.])
+
+test -n "$aux_missing" && AC_MSG_WARN([
+*** These auxiliary programs are missing or incompatible versions:$aux_missing
+*** some features or tests will be disabled.
+*** Check the INSTALL file for required versions.])
+
+
# Determine whether to use fpu or nofpu sysdeps directories.
AC_CACHE_CHECK([for use of fpu sysdeps directories],
libc_cv_with_fp, [dnl
# The other names were emitted during the scan.
AC_MSG_RESULT($default_sysnames)
-
-### Locate tools.
-
-AC_PROG_INSTALL
-if test "$INSTALL" = "${srcdir}/scripts/install-sh -c"; then
- # The makefiles need to use a different form to find it in $srcdir.
- INSTALL='\$(..)./scripts/install-sh -c'
-fi
-AC_PROG_LN_S
-
-LIBC_PROG_BINUTILS
-
-# Accept binutils 2.25 or newer.
-AC_CHECK_PROG_VER(AS, $AS, --version,
- [GNU assembler.* \([0-9]*\.[0-9.]*\)],
- [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
- AS=: critic_missing="$critic_missing as")
-
-libc_cv_with_lld=no
-case $($LD --version) in
- "GNU gold"*)
- # Accept gold 1.14 or higher
- AC_CHECK_PROG_VER(LD, $LD, --version,
- [GNU gold.* \([0-9][0-9]*\.[0-9.]*\)],
- [1.1[4-9]*|1.[2-9][0-9]*|1.1[0-9][0-9]*|[2-9].*|[1-9][0-9]*],
- LD=: critic_missing="$critic_missing GNU gold")
- ;;
- "LLD"*)
- # Accept LLD 13.0.0 or higher
- AC_CHECK_PROG_VER(LD, $LD, --version,
- [LLD.* \([0-9][0-9]*\.[0-9.]*\)],
- [1[3-9].*|[2-9][0-9].*],
- LD=: critic_missing="$critic_missing LLD")
- libc_cv_with_lld=yes
- ;;
- *)
- AC_CHECK_PROG_VER(LD, $LD, --version,
- [GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
- [2.1[0-9][0-9]*|2.2[5-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
- LD=: critic_missing="$critic_missing GNU ld")
- ;;
-esac
-LIBC_CONFIG_VAR([with-lld], [$libc_cv_with_lld])
-
-# These programs are version sensitive.
-AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
- [GNU Make[^0-9]*\([0-9][0-9.]*\)],
- [[4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
-
-AC_CHECK_PROG_VER(MSGFMT, gnumsgfmt gmsgfmt msgfmt, --version,
- [GNU gettext.* \([0-9]*\.[0-9.]*\)],
- [0.10.3[6-9]* | 0.10.[4-9][0-9]* | 0.1[1-9]* | 0.[2-9][0-9]* | [1-9].*],
- MSGFMT=: aux_missing="$aux_missing msgfmt")
-AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
- [GNU texinfo.* \([0-9][0-9.]*\)],
- [4.[7-9]*|4.[1-9][0-9]*|[5-9].*],
- MAKEINFO=: aux_missing="$aux_missing makeinfo")
-AC_CHECK_PROG_VER(SED, sed, --version,
- [GNU sed[^0-9]* \([0-9]*\.[0-9.]*\)],
- [3.0[2-9]*|3.[1-9]*|[4-9]*],
- SED=: aux_missing="$aux_missing sed")
-AC_CHECK_PROG_VER(AWK, gawk, --version,
- [GNU Awk[^0-9]*\([0-9][0-9.]*\)],
- [3.1.[2-9]*|3.[2-9]*|[4-9]*], critic_missing="$critic_missing gawk")
-AC_CHECK_PROG_VER(BISON, bison, --version,
- [bison (GNU Bison) \([0-9]*\.[0-9.]*\)],
- [2.7*|[3-9].*|[1-9][0-9]*], critic_missing="$critic_missing bison")
-
-AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
-AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[]], [[
-#if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
-#error insufficient compiler
-#endif]])],
- [libc_cv_compiler_ok=yes],
- [libc_cv_compiler_ok=no])])
-AS_IF([test $libc_cv_compiler_ok != yes],
- [critic_missing="$critic_missing compiler"])
-
-AC_CHECK_TOOL(NM, nm, false)
-
-if test "x$maintainer" = "xyes"; then
- AC_CHECK_PROGS(AUTOCONF, autoconf, no)
- case "x$AUTOCONF" in
- xno|x|x:) AUTOCONF=no ;;
- *)
- AC_CACHE_CHECK(dnl
- whether $AUTOCONF${ACFLAGS:+ }$ACFLAGS works, libc_cv_autoconf_works, [dnl
- if (cd $srcdir; $AUTOCONF $ACFLAGS configure.ac > /dev/null 2>&1); then
- libc_cv_autoconf_works=yes
- else
- libc_cv_autoconf_works=no
- fi])
- test $libc_cv_autoconf_works = yes || AUTOCONF=no
- ;;
- esac
- if test "x$AUTOCONF" = xno; then
- aux_missing="$aux_missing autoconf"
- fi
-else
- AUTOCONF=no
-fi
-
-# Check for python3 if available, or else python.
-AC_CHECK_PROG_VER(PYTHON_PROG, python3 python, --version,
- [Python \([0-9][0-9.]*\)],
- [3.[4-9]*|3.[1-9][0-9]*|[4-9].*|[1-9][0-9]*],
- critic_missing="$critic_missing python")
-PYTHON="$PYTHON_PROG -B"
-AC_SUBST(PYTHON)
-
-test -n "$critic_missing" && AC_MSG_ERROR([
-*** These critical programs are missing or too old:$critic_missing
-*** Check the INSTALL file for required versions.])
-
-test -n "$aux_missing" && AC_MSG_WARN([
-*** These auxiliary programs are missing or incompatible versions:$aux_missing
-*** some features or tests will be disabled.
-*** Check the INSTALL file for required versions.])
-
# if using special system headers, find out the compiler's sekrit
# header directory and add that to the list. NOTE: Only does the right
# thing on a system that doesn't need fixincludes. (Not presently a problem.)
LIBC_CONFIG_VAR([have-mtls-dialect-gnu2], [$libc_cv_mtls_dialect_gnu2])
dnl clang emits an warning for a double alias redirection, to warn the
-dnl original symbol is sed even when weak definition overriddes it.
+dnl original symbol is sed even when weak definition overrides it.
dnl It is a usual pattern for weak_alias, where multiple alias point to
dnl same symbol.
AC_CACHE_CHECK([if -Wno-ignored-attributes is required for aliases],
fi
AC_SUBST(have_selinux)
-CPPUNDEFS=
-dnl Check for silly hacked compilers predefining _FORTIFY_SOURCE.
-dnl Since we are building the implementations of the fortified functions here,
-dnl having the macro defined interacts very badly.
-dnl _FORTIFY_SOURCE requires compiler optimization level 1 (gcc -O1)
-dnl and above (see "man FEATURE_TEST_MACROS").
-dnl So do NOT replace AC_COMPILE_IFELSE with AC_PREPROC_IFELSE.
-AC_CACHE_CHECK([for _FORTIFY_SOURCE predefine], libc_cv_predef_fortify_source,
-[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
-#ifdef _FORTIFY_SOURCE
-# error bogon
-#endif]])],
- [libc_cv_predef_fortify_source=no],
- [libc_cv_predef_fortify_source=yes])])
-if test $libc_cv_predef_fortify_source = yes; then
- CPPUNDEFS="${CPPUNDEFS:+$CPPUNDEFS }-U_FORTIFY_SOURCE"
-fi
-AC_SUBST(CPPUNDEFS)
+dnl Check if we support the requested _FORTIFY_SOURCE level
+dnl If not, then don't use it.
+dnl Note that _FORTIFY_SOURCE may have been set through FLAGS too.
+dnl _FORTIFY_SOURCE value will be selectively disabled for function that can't
+dnl support it
+no_fortify_source="-Wp,-U_FORTIFY_SOURCE"
+fortify_source="${no_fortify_source}"
+
+AC_CACHE_CHECK([for __builtin_dynamic_object_size], [libc_cv___builtin_dynamic_object_size], [
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([], [__builtin_dynamic_object_size("", 0)])],
+ [libc_cv___builtin_dynamic_object_size=yes
+ AS_IF([test "$enable_fortify_source" = yes], [enable_fortify_source=3])],
+ [libc_cv___builtin_dynamic_object_size=no
+ AS_IF([test "$enable_fortify_source" = yes], [enable_fortify_source=2])])
+])
+
+AS_CASE([$enable_fortify_source],
+ [1|2], [libc_cv_fortify_source=yes],
+ [3], [AS_IF([test "$libc_cv___builtin_dynamic_object_size" = yes],
+ [libc_cv_fortify_source=yes],
+ [AC_MSG_ERROR([Compiler doesn't provide necessary support for _FORTIFY_SOURCE=3])])],
+ [libc_cv_fortify_source=no])
+
+AS_IF([test "$libc_cv_fortify_source" = yes],
+ [fortify_source="${fortify_source},-D_FORTIFY_SOURCE=${enable_fortify_source}"]
+ )
+
+AC_SUBST(enable_fortify_source)
+AC_SUBST(libc_cv_fortify_source)
+AC_SUBST(no_fortify_source)
+AC_SUBST(fortify_source)
dnl Starting with binutils 2.35, GAS can attach multiple symbol versions
dnl to one symbol (PR 23840).