From 75a2bcc07f19c1bc6439e6dab6c1b99281e675a0 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Fri, 15 Nov 2013 12:34:28 +0000 Subject: acinclude.m4 (GCC_GLIBC_VERSION_GTE_IFELSE): New configure macro. * acinclude.m4 (GCC_GLIBC_VERSION_GTE_IFELSE): New configure macro. * configure.ac: Determine target_header_dir earlier. (--with-glibc-version): New configure option. Use GCC_GLIBC_VERSION_GTE_IFELSE in enable_gnu_unique_object, gcc_cv_libc_provides_ssp and gcc_cv_target_ldbl128 tests. * configure: Regenerate. * doc/install.texi (--enable-gnu-unique-object): Don't refer to native toolchains for default. (--with-glibc-version): Document. From-SVN: r204841 --- gcc/configure | 129 ++++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 81 insertions(+), 48 deletions(-) (limited to 'gcc/configure') diff --git a/gcc/configure b/gcc/configure index b5e2fc2..c8fef61 100755 --- a/gcc/configure +++ b/gcc/configure @@ -915,6 +915,7 @@ with_plugin_ld enable_gnu_indirect_function enable_initfini_array enable_comdat +with_glibc_version enable_gnu_unique_object enable_linker_build_id with_long_double_128 @@ -1680,6 +1681,8 @@ Optional Packages: both] --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-plugin-ld=[ARG] specify the plugin linker + --with-glibc-version=M.N + assume GCC used with glibc version M.N or later --with-long-double-128 use 128-bit long double by default --with-gc={page,zone} this option is not supported anymore. It used to choose the garbage collection mechanism to use with @@ -17913,7 +17916,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 17916 "configure" +#line 17919 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -18019,7 +18022,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 18022 "configure" +#line 18025 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -26386,6 +26389,60 @@ $as_echo "#define HAVE_GAS_LCOMM_WITH_ALIGNMENT 1" >>confdefs.h fi +if test x$with_sysroot = x && test x$host = x$target \ + && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \ + && test "$prefix" != "NONE"; then + +cat >>confdefs.h <<_ACEOF +#define PREFIX_INCLUDE_DIR "$prefix/include" +_ACEOF + +fi + +if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then + if test "x$with_headers" != x; then + target_header_dir=$with_headers + elif test "x$with_sysroot" = x; then + target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" + elif test "x$with_build_sysroot" != "x"; then + target_header_dir="${with_build_sysroot}${native_system_header_dir}" + elif test "x$with_sysroot" = xyes; then + target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" + else + target_header_dir="${with_sysroot}${native_system_header_dir}" + fi +else + target_header_dir=${native_system_header_dir} +fi + +# Determine the version of glibc, if any, used on the target. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for target glibc version" >&5 +$as_echo_n "checking for target glibc version... " >&6; } + +# Check whether --with-glibc-version was given. +if test "${with_glibc_version+set}" = set; then : + withval=$with_glibc_version; +if echo "$with_glibc_version" | grep '^[0-9][0-9]*\.[0-9][0-9]*$'; then + glibc_version_major=`echo "$with_glibc_version" | sed -e 's/\..*//'` + glibc_version_minor=`echo "$with_glibc_version" | sed -e 's/.*\.//'` +else + as_fn_error "option --with-glibc-version requires a version number M.N" "$LINENO" 5 +fi +else + +glibc_version_major=0 +glibc_version_minor=0 +if test -f $target_header_dir/features.h \ + && glibc_version_major_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+[0-9]' $target_header_dir/features.h` \ + && glibc_version_minor_define=`$EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+[0-9]' $target_header_dir/features.h`; then + glibc_version_major=`echo "$glibc_version_major_define" | sed -e 's/.*__GLIBC__[ ]*//'` + glibc_version_minor=`echo "$glibc_version_minor_define" | sed -e 's/.*__GLIBC_MINOR__[ ]*//'` +fi +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibc_version_major.$glibc_version_minor" >&5 +$as_echo "$glibc_version_major.$glibc_version_minor" >&6; } + # Check whether --enable-gnu-unique-object was given. if test "${enable_gnu_unique_object+set}" = set; then : enableval=$enable_gnu_unique_object; case $enable_gnu_unique_object in @@ -26427,16 +26484,12 @@ $as_echo "$gcc_cv_as_gnu_unique_object" >&6; } if test $gcc_cv_as_gnu_unique_object = yes; then # We need to unquote above to to use the definition from config.gcc. # Also check for ld.so support, i.e. glibc 2.11 or higher. - if test x$host = x$build -a x$host = x$target && - ldd --version 2>/dev/null && - glibcver=`ldd --version 2>/dev/null | sed 's/.* //;q'`; then - glibcmajor=`expr "$glibcver" : "\([0-9]*\)"` - glibcminor=`expr "$glibcver" : "[2-9]*\.\([0-9]*\)"` - glibcnum=`expr $glibcmajor \* 1000 + $glibcminor` - if test "$glibcnum" -ge 2011 ; then - enable_gnu_unique_object=yes - fi - fi + +if test $glibc_version_major -gt 2 \ + || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 11 ); then : + enable_gnu_unique_object=yes +fi + fi fi @@ -27015,32 +27068,6 @@ $as_echo "#define HAVE_LD_SYSROOT 1" >>confdefs.h fi -if test x$with_sysroot = x && test x$host = x$target \ - && test "$prefix" != "/usr" && test "x$prefix" != "x$local_prefix" \ - && test "$prefix" != "NONE"; then - -cat >>confdefs.h <<_ACEOF -#define PREFIX_INCLUDE_DIR "$prefix/include" -_ACEOF - -fi - -if test x$host != x$target || test "x$TARGET_SYSTEM_ROOT" != x; then - if test "x$with_headers" != x; then - target_header_dir=$with_headers - elif test "x$with_sysroot" = x; then - target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-include" - elif test "x$with_build_sysroot" != "x"; then - target_header_dir="${with_build_sysroot}${native_system_header_dir}" - elif test "x$with_sysroot" = xyes; then - target_header_dir="${test_exec_prefix}/${target_noncanonical}/sys-root${native_system_header_dir}" - else - target_header_dir="${with_sysroot}${native_system_header_dir}" - fi -else - target_header_dir=${native_system_header_dir} -fi - # Test for stack protector support in target C library. { $as_echo "$as_me:${as_lineno-$LINENO}: checking __stack_chk_fail in target C library" >&5 $as_echo_n "checking __stack_chk_fail in target C library... " >&6; } @@ -27052,18 +27079,16 @@ else *-*-linux* | *-*-kfreebsd*-gnu | *-*-knetbsd*-gnu) # glibc 2.4 and later provides __stack_chk_fail and # either __stack_chk_guard, or TLS access to stack guard canary. + +if test $glibc_version_major -gt 2 \ + || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then : + gcc_cv_libc_provides_ssp=yes +else + if test -f $target_header_dir/features.h \ && $EGREP '^[ ]*#[ ]*define[ ]+__GNU_LIBRARY__[ ]+([1-9][0-9]|[6-9])' \ $target_header_dir/features.h > /dev/null; then - if $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+([1-9][0-9]|[3-9])' \ - $target_header_dir/features.h > /dev/null; then - gcc_cv_libc_provides_ssp=yes - elif $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC__[ ]+2' \ - $target_header_dir/features.h > /dev/null \ - && $EGREP '^[ ]*#[ ]*define[ ]+__GLIBC_MINOR__[ ]+([1-9][0-9]|[4-9])' \ - $target_header_dir/features.h > /dev/null; then - gcc_cv_libc_provides_ssp=yes - elif $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \ + if $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC__[ ]+1' \ $target_header_dir/features.h > /dev/null && \ test -f $target_header_dir/bits/uClibc_config.h && \ $EGREP '^[ ]*#[ ]*define[ ]+__UCLIBC_HAS_SSP__[ ]+1' \ @@ -27076,6 +27101,7 @@ else $target_header_dir/sys/cdefs.h > /dev/null; then gcc_cv_libc_provides_ssp=yes fi +fi ;; *-*-gnu*) # Avoid complicated tests (see @@ -27131,12 +27157,19 @@ case "$target" in if test "${with_long_double_128+set}" = set; then : withval=$with_long_double_128; gcc_cv_target_ldbl128="$with_long_double_128" else - gcc_cv_target_ldbl128=no + +if test $glibc_version_major -gt 2 \ + || ( test $glibc_version_major -eq 2 && test $glibc_version_minor -ge 4 ); then : + gcc_cv_target_ldbl128=yes +else + + gcc_cv_target_ldbl128=no grep '^[ ]*#[ ]*define[ ][ ]*__LONG_DOUBLE_MATH_OPTIONAL' \ $target_header_dir/bits/wordsize.h > /dev/null 2>&1 \ && gcc_cv_target_ldbl128=yes fi +fi ;; esac -- cgit v1.1