Blame configure.ac

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