Fix bootstrap failure for bare metal due to autoconf link tests

The AC_CHECK_FUNCS tests cause the build to fail for bare metal cross
compilers, where link tests are not allowed. Replace them with
GCC_TRY_COMPILE_OR_LINK tests instead. Skip all the Filesystem
dependency checks if not building the filesystem library.

	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Only check when
	enable_libstdcxx_filesystem_ts = yes. Check for link, readlink and
	symlink.
	* config.h.in: Regenerate.
	* configure: Regenerate.
	* configure.ac: Remove AC_CHECK_FUNCS for link, readlink and symlink.

From-SVN: r261704
This commit is contained in:
Jonathan Wakely 2018-06-18 17:01:24 +01:00 committed by Jonathan Wakely
parent 3be9ded290
commit 7314856c61
5 changed files with 770 additions and 556 deletions

View File

@ -1,5 +1,12 @@
2018-06-18 Jonathan Wakely <jwakely@redhat.com> 2018-06-18 Jonathan Wakely <jwakely@redhat.com>
* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Only check when
enable_libstdcxx_filesystem_ts = yes. Check for link, readlink and
symlink.
* config.h.in: Regenerate.
* configure: Regenerate.
* configure.ac: Remove AC_CHECK_FUNCS for link, readlink and symlink.
LWG 3035. std::allocator's constructors should be constexpr LWG 3035. std::allocator's constructors should be constexpr
* include/bits/allocator.h (allocator): Add constexpr to constructors * include/bits/allocator.h (allocator): Add constexpr to constructors
for C++2a. Replace dynamic exception specifications with NOTHROW for C++2a. Replace dynamic exception specifications with NOTHROW

View File

@ -4309,11 +4309,22 @@ AC_DEFUN([GLIBCXX_ENABLE_FILESYSTEM_TS], [
]) ])
dnl dnl
dnl Check whether the library calls required by the Filesystem TS are present dnl Check whether the library calls required by the Filesystem TS are present.
dnl and define _GLIBCXX_USE_REALPATH and _GLIBCXX_USE_UTIMENSAT. dnl Defines:
dnl HAVE_STRUCT_DIRENT_D_TYPE
dnl _GLIBCXX_USE_REALPATH
dnl _GLIBCXX_USE_UTIMENSAT
dnl _GLIBCXX_USE_ST_MTIM
dnl _GLIBCXX_USE_FCHMOD
dnl _GLIBCXX_USE_FCHMODAT
dnl _GLIBCXX_USE_SENDFILE
dnl HAVE_LINK
dnl HAVE_READLINK
dnl HAVE_SYMLINK
dnl dnl
AC_DEFUN([GLIBCXX_CHECK_FILESYSTEM_DEPS], [dnl AC_DEFUN([GLIBCXX_CHECK_FILESYSTEM_DEPS], [dnl
dnl dnl
if test $enable_libstdcxx_filesystem_ts = yes; then
AC_LANG_SAVE AC_LANG_SAVE
AC_LANG_CPLUSPLUS AC_LANG_CPLUSPLUS
ac_save_CXXFLAGS="$CXXFLAGS" ac_save_CXXFLAGS="$CXXFLAGS"
@ -4443,9 +4454,49 @@ dnl
AC_DEFINE(_GLIBCXX_USE_SENDFILE, 1, [Define if sendfile is available in <sys/sendfile.h>.]) AC_DEFINE(_GLIBCXX_USE_SENDFILE, 1, [Define if sendfile is available in <sys/sendfile.h>.])
fi fi
AC_MSG_RESULT($glibcxx_cv_sendfile) AC_MSG_RESULT($glibcxx_cv_sendfile)
dnl
AC_MSG_CHECKING([for link])
AC_CACHE_VAL(glibcxx_cv_link, [dnl
GCC_TRY_COMPILE_OR_LINK(
[#include <unistd.h>],
[link("", "");],
[glibcxx_cv_link=yes],
[glibcxx_cv_link=no])
])
if test $glibcxx_cv_link = yes; then
AC_DEFINE(HAVE_LINK, 1, [Define if link is available in <unistd.h>.])
fi
AC_MSG_RESULT($glibcxx_cv_link)
dnl
AC_MSG_CHECKING([for readlink])
AC_CACHE_VAL(glibcxx_cv_readlink, [dnl
GCC_TRY_COMPILE_OR_LINK(
[#include <unistd.h>],
[char buf[32]; readlink("", buf, sizeof(buf));],
[glibcxx_cv_readlink=yes],
[glibcxx_cv_readlink=no])
])
if test $glibcxx_cv_readlink = yes; then
AC_DEFINE(HAVE_READLINK, 1, [Define if readlink is available in <unistd.h>.])
fi
AC_MSG_RESULT($glibcxx_cv_readlink)
dnl
AC_MSG_CHECKING([for symlink])
AC_CACHE_VAL(glibcxx_cv_symlink, [dnl
GCC_TRY_COMPILE_OR_LINK(
[#include <unistd.h>],
[symlink("", "");],
[glibcxx_cv_symlink=yes],
[glibcxx_cv_symlink=no])
])
if test $glibcxx_cv_symlink = yes; then
AC_DEFINE(HAVE_SYMLINK, 1, [Define if symlink is available in <unistd.h>.])
fi
AC_MSG_RESULT($glibcxx_cv_symlink)
dnl dnl
CXXFLAGS="$ac_save_CXXFLAGS" CXXFLAGS="$ac_save_CXXFLAGS"
AC_LANG_RESTORE AC_LANG_RESTORE
fi
]) ])
dnl dnl

View File

@ -264,7 +264,7 @@
/* Only used in build directory testsuite_hooks.h. */ /* Only used in build directory testsuite_hooks.h. */
#undef HAVE_LIMIT_VMEM #undef HAVE_LIMIT_VMEM
/* Define to 1 if you have the `link' function. */ /* Define if link is available in <unistd.h>. */
#undef HAVE_LINK #undef HAVE_LINK
/* Define if futex syscall is available. */ /* Define if futex syscall is available. */
@ -342,7 +342,7 @@
/* Define to 1 if you have the `quick_exit' function. */ /* Define to 1 if you have the `quick_exit' function. */
#undef HAVE_QUICK_EXIT #undef HAVE_QUICK_EXIT
/* Define to 1 if you have the `readlink' function. */ /* Define if readlink is available in <unistd.h>. */
#undef HAVE_READLINK #undef HAVE_READLINK
/* Define to 1 if you have the `setenv' function. */ /* Define to 1 if you have the `setenv' function. */
@ -414,7 +414,7 @@
/* Define if strxfrm_l is available in <string.h>. */ /* Define if strxfrm_l is available in <string.h>. */
#undef HAVE_STRXFRM_L #undef HAVE_STRXFRM_L
/* Define to 1 if you have the `symlink' function. */ /* Define if symlink is available in <unistd.h>. */
#undef HAVE_SYMLINK #undef HAVE_SYMLINK
/* Define to 1 if the target runtime linker supports binding the same symbol /* Define to 1 if the target runtime linker supports binding the same symbol

183
libstdc++-v3/configure vendored
View File

@ -80047,19 +80047,6 @@ _ACEOF
fi fi
done
for ac_func in link readlink symlink
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
eval as_val=\$$as_ac_var
if test "x$as_val" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done done
@ -80105,6 +80092,7 @@ $as_echo_n "checking whether to build Filesystem TS support... " >&6; }
$as_echo "$enable_libstdcxx_filesystem_ts" >&6; } $as_echo "$enable_libstdcxx_filesystem_ts" >&6; }
if test $enable_libstdcxx_filesystem_ts = yes; then
ac_ext=cpp ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS' ac_cpp='$CXXCPP $CPPFLAGS'
@ -80567,6 +80555,174 @@ $as_echo "#define _GLIBCXX_USE_SENDFILE 1" >>confdefs.h
fi fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sendfile" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sendfile" >&5
$as_echo "$glibcxx_cv_sendfile" >&6; } $as_echo "$glibcxx_cv_sendfile" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for link" >&5
$as_echo_n "checking for link... " >&6; }
if test "${glibcxx_cv_link+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test x$gcc_no_link = xyes; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
main ()
{
link("", "");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
glibcxx_cv_link=yes
else
glibcxx_cv_link=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
if test x$gcc_no_link = xyes; then
as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
main ()
{
link("", "");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
glibcxx_cv_link=yes
else
glibcxx_cv_link=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
fi
if test $glibcxx_cv_link = yes; then
$as_echo "#define HAVE_LINK 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_link" >&5
$as_echo "$glibcxx_cv_link" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for readlink" >&5
$as_echo_n "checking for readlink... " >&6; }
if test "${glibcxx_cv_readlink+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test x$gcc_no_link = xyes; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
main ()
{
char buf[32]; readlink("", buf, sizeof(buf));
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
glibcxx_cv_readlink=yes
else
glibcxx_cv_readlink=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
if test x$gcc_no_link = xyes; then
as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
main ()
{
char buf[32]; readlink("", buf, sizeof(buf));
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
glibcxx_cv_readlink=yes
else
glibcxx_cv_readlink=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
fi
if test $glibcxx_cv_readlink = yes; then
$as_echo "#define HAVE_READLINK 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_readlink" >&5
$as_echo "$glibcxx_cv_readlink" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for symlink" >&5
$as_echo_n "checking for symlink... " >&6; }
if test "${glibcxx_cv_symlink+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test x$gcc_no_link = xyes; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
main ()
{
symlink("", "");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
glibcxx_cv_symlink=yes
else
glibcxx_cv_symlink=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
if test x$gcc_no_link = xyes; then
as_fn_error "Link tests are not allowed after GCC_NO_EXECUTABLES." "$LINENO" 5
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <unistd.h>
int
main ()
{
symlink("", "");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
glibcxx_cv_symlink=yes
else
glibcxx_cv_symlink=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
fi
if test $glibcxx_cv_symlink = yes; then
$as_echo "#define HAVE_SYMLINK 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_symlink" >&5
$as_echo "$glibcxx_cv_symlink" >&6; }
CXXFLAGS="$ac_save_CXXFLAGS" CXXFLAGS="$ac_save_CXXFLAGS"
ac_ext=c ac_ext=c
ac_cpp='$CPP $CPPFLAGS' ac_cpp='$CPP $CPPFLAGS'
@ -80574,6 +80730,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_compiler_gnu=$ac_cv_c_compiler_gnu
fi
# For Transactional Memory TS # For Transactional Memory TS

View File

@ -420,7 +420,6 @@ GLIBCXX_CHECK_GTHREADS
# For Filesystem TS. # For Filesystem TS.
AC_CHECK_HEADERS([fcntl.h dirent.h sys/statvfs.h utime.h]) AC_CHECK_HEADERS([fcntl.h dirent.h sys/statvfs.h utime.h])
AC_CHECK_FUNCS(link readlink symlink)
GLIBCXX_ENABLE_FILESYSTEM_TS GLIBCXX_ENABLE_FILESYSTEM_TS
GLIBCXX_CHECK_FILESYSTEM_DEPS GLIBCXX_CHECK_FILESYSTEM_DEPS