dnl Process this file with autoconf to produce a configure script.
dnl Note we do not use AC_PREREQ here! See aclocal.m4 for what we use instead.
-AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/], [glibc])
+AC_INIT([GNU C Library], [(see version.h)], [https://sourceware.org/bugzilla/],
+ [glibc], [https://www.gnu.org/software/glibc/])
AC_CONFIG_SRCDIR([include/features.h])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([scripts])
ACX_PKGVERSION([GNU libc])
-ACX_BUGURL([http://www.gnu.org/software/libc/bugs.html])
+ACX_BUGURL([https://www.gnu.org/software/libc/bugs.html])
AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"],
[Package description])
AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"],
fi
dnl Arguments to specify presence of other packages/features.
-AC_ARG_WITH([fp],
- AC_HELP_STRING([--with-fp],
- [if using floating-point hardware @<:@default=yes@:>@]),
- [with_fp=$withval],
- [with_fp=yes])
-AC_SUBST(with_fp)
AC_ARG_WITH([binutils],
AC_HELP_STRING([--with-binutils=PATH],
[specify location of binutils (as and ld)]),
[use_default_link=$withval],
[use_default_link=default])
+dnl Additional build flags injection.
+AC_ARG_WITH([nonshared-cflags],
+ AC_HELP_STRING([--with-nonshared-cflags=CFLAGS],
+ [build nonshared libraries with additional CFLAGS]),
+ [extra_nonshared_cflags=$withval],
+ [extra_nonshared_cflags=])
+AC_SUBST(extra_nonshared_cflags)
+
AC_ARG_ENABLE([sanity-checks],
AC_HELP_STRING([--disable-sanity-checks],
[really do not use threads (should not be used except in special situations) @<:@default=yes@:>@]),
[build profiled library @<:@default=no@:>@]),
[profile=$enableval],
[profile=no])
+AC_ARG_ENABLE([static-pie],
+ AC_HELP_STRING([--enable-static-pie],
+ [enable static PIE support and use it in the testsuite @<:@default=no@:>@]),
+ [static_pie=$enableval],
+ [static_pie=no])
AC_ARG_ENABLE([timezone-tools],
AC_HELP_STRING([--disable-timezone-tools],
[do not install timezone tools @<:@default=install@:>@]),
[experimental_malloc=yes])
AC_SUBST(experimental_malloc)
+AC_ARG_ENABLE([crypt],
+ AC_HELP_STRING([--disable-crypt],
+ [do not build nor install the passphrase hashing library, libcrypt]),
+ [build_crypt=$enableval],
+ [build_crypt=yes])
+AC_SUBST(build_crypt)
+
AC_ARG_ENABLE([nss-crypt],
AC_HELP_STRING([--enable-nss-crypt],
[enable libcrypt to use nss]),
[nss_crypt=$enableval],
[nss_crypt=no])
+if test x$build_libcrypt = xno && test x$nss_crypt = xyes; then
+ AC_MSG_WARN([--enable-nss-crypt has no effect when libcrypt is disabled])
+ nss_crypt=no
+fi
if test x$nss_crypt = xyes; then
nss_includes=-I$(nss-config --includedir 2>/dev/null)
if test $? -ne 0; then
[build_mathvec=$enableval],
[build_mathvec=notset])
+AC_ARG_ENABLE([cet],
+ AC_HELP_STRING([--enable-cet],
+ [enable Intel Control-flow Enforcement Technology (CET), x86 only]),
+ [enable_cet=$enableval],
+ [enable_cet=no])
+
# 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.
# check below.
libc_config_ok=no
+# A preconfigure script for a system that may or may not use fpu
+# sysdeps directories sets this to a preprocessor conditional for
+# whether to use such directories.
+with_fp_cond=1
+
dnl Let sysdeps/*/preconfigure act here.
LIBC_PRECONFIGURE([$srcdir], [for sysdeps])
test -n "$base_machine" || base_machine=$machine
AC_SUBST(base_machine)
+# Determine whether to use fpu or nofpu sysdeps directories.
+AC_CACHE_CHECK([for use of fpu sysdeps directories],
+ libc_cv_with_fp, [dnl
+cat > conftest.c <<EOF
+#if $with_fp_cond
+int dummy;
+#else
+# error "no hardware floating point"
+#endif
+EOF
+libc_cv_with_fp=no
+if ${CC-cc} $CFLAGS $CPPFLAGS -S conftest.c -o conftest.s \
+ 1>&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ; then
+ libc_cv_with_fp=yes
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_with_fp)
+
AC_CACHE_CHECK(for -fstack-protector, libc_cv_ssp, [dnl
LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector],
[libc_cv_ssp=yes],
fi
rm -f conftest*])
+# Check if linker supports textrel relocation with ifunc (used on elf/tests).
+# Note that it relies on libc_cv_ld_gnu_indirect_function test above.
+AC_CACHE_CHECK([whether the linker supports textrels along with ifunc],
+ libc_cv_textrel_ifunc, [dnl
+cat > conftest.S <<EOF
+.type foo,%gnu_indirect_function
+foo:
+.globl _start
+_start:
+.globl __start
+__start:
+.data
+#ifdef _LP64
+.quad foo
+#else
+.long foo
+#endif
+.text
+.globl address
+address:
+#ifdef _LP64
+.quad address
+#else
+.long address
+#endif
+EOF
+libc_cv_textrel_ifunc=no
+if test $libc_cv_ld_gnu_indirect_function = yes; then
+ if AC_TRY_COMMAND(${CC-cc} $CFLAGS $CPPFLAGS $LDFLAGS -nostartfiles -nostdlib $no_ssp -pie -o conftest conftest.S); then
+ libc_cv_textrel_ifunc=yes
+ fi
+fi
+rm -f conftest*])
+AC_SUBST(libc_cv_textrel_ifunc)
+
# Check if gcc warns about alias for function with incompatible types.
AC_CACHE_CHECK([if compiler warns about alias for function with incompatible types],
libc_cv_gcc_incompatible_alias, [dnl
while m=`echo $tail | sed 's@^\(.*\)/\([^/]*\)$@& \1@'`; test -n "$m"; do
set $m
# Prepend the machine's FPU directory unless --without-fp.
- if test "$with_fp" = yes; then
+ if test "$libc_cv_with_fp" = yes; then
maybe_fpu=/fpu
else
maybe_fpu=/nofpu
AC_CHECK_TOOL_PREFIX
AC_CHECK_PROG_VER(MAKE, gnumake gmake make, --version,
[GNU Make[^0-9]*\([0-9][0-9.]*\)],
- [3.79* | 3.[89]* | [4-9].* | [1-9][0-9]*], critic_missing="$critic_missing make")
+ [[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.]*\)],
AC_CACHE_CHECK([if $CC is sufficient to build libc], libc_cv_compiler_ok, [
AC_TRY_COMPILE([], [
-#if !defined __GNUC__ || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 9)
+#if !defined __GNUC__ || __GNUC__ < 6 || (__GNUC__ == 6 && __GNUC_MINOR__ < 2)
#error insufficient compiler
#endif],
[libc_cv_compiler_ok=yes],
fi
# Check for python3 if available, or else python.
-AC_CHECK_PROGS(PYTHON_PROG, python3 python,no)
-case "x$PYTHON_PROG" in
-xno|x|x:) PYTHON_PROG=no ;;
-*) ;;
-esac
-
-if test "x$PYTHON_PROG" = xno; then
- aux_missing="$aux_missing python"
-else
- PYTHON="$PYTHON_PROG -B"
- AC_SUBST(PYTHON)
-fi
+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
[libc_cv_z_execstack=yes], [libc_cv_z_execstack=no])
AC_SUBST(libc_cv_z_execstack)
+LIBC_LINKER_FEATURE([--no-dynamic-linker],
+ [-Wl,--no-dynamic-linker],
+ [libc_cv_no_dynamic_linker=yes],
+ [libc_cv_no_dynamic_linker=no])
+LIBC_CONFIG_VAR([have-no-dynamic-linker], [$libc_cv_no_dynamic_linker])
+
+AC_CACHE_CHECK(for -static-pie, libc_cv_static_pie, [dnl
+LIBC_TRY_CC_OPTION([-static-pie],
+ [libc_cv_static_pie=yes],
+ [libc_cv_static_pie=no])
+])
+LIBC_CONFIG_VAR([have-static-pie], [$libc_cv_static_pie])
+
AC_CACHE_CHECK(for -fpie, libc_cv_fpie, [dnl
LIBC_TRY_CC_OPTION([-fpie], [libc_cv_fpie=yes], [libc_cv_fpie=no])
])
if test x"$libc_cv_ld_gnu_indirect_function" = xyes; then
AC_DEFINE(HAVE_IFUNC)
fi
+LIBC_CONFIG_VAR([have-ifunc], [$libc_cv_ld_gnu_indirect_function])
if test x"$libc_cv_gcc_indirect_function" = xyes; then
AC_DEFINE(HAVE_GCC_IFUNC)
rm -f conftest.*])
AC_SUBST(libc_cv_pic_default)
-AC_CACHE_CHECK([whether -fPIE is default], libc_cv_pie_default,
-[libc_cv_pie_default=yes
+AC_CACHE_CHECK([whether -fPIE is default], libc_cv_cc_pie_default,
+[libc_cv_cc_pie_default=yes
cat > conftest.c <<EOF
#if defined __PIE__ || defined __pie__ || defined PIE || defined pie
# error PIE is default.
#endif
EOF
if eval "${CC-cc} -S conftest.c 2>&AS_MESSAGE_LOG_FD 1>&AS_MESSAGE_LOG_FD"; then
- libc_cv_pie_default=no
+ libc_cv_cc_pie_default=no
fi
rm -f conftest.*])
+libc_cv_pie_default=$libc_cv_cc_pie_default
+AC_SUBST(libc_cv_cc_pie_default)
AC_SUBST(libc_cv_pie_default)
# Set the `multidir' variable by grabbing the variable from the compiler.
libc_cv_multidir=`${CC-cc} $CFLAGS $CPPFLAGS -print-multi-directory`
AC_SUBST(libc_cv_multidir)
+if test "$static_pie" = yes; then
+ # The linker must support --no-dynamic-linker.
+ if test "$libc_cv_no_dynamic_linker" != yes; then
+ AC_MSG_ERROR([linker support for --no-dynamic-linker needed])
+ fi
+ # Default to PIE.
+ libc_cv_pie_default=yes
+ AC_DEFINE(ENABLE_STATIC_PIE)
+fi
+LIBC_CONFIG_VAR([enable-static-pie], [$static_pie])
+
AC_SUBST(profile)
AC_SUBST(static_nss)