Oops, that message got bounced from the lists and was the wrong version of the patch anyway - this is the one I meant to attach.
On Sun, 17 Jun 2018 at 00:00, Jonathan Wakely <jwakely....@gmail.com> wrote: > > Here's what I wanted to test, which removes the new AC_CHECK_FUNCS (replacing > them with GLIBCXX_COMPILE_OR_LINK tests that shouldn't even get run on bare > metal ). > > > > On Sat, 16 Jun 2018 at 23:39, Jonathan Wakely <jwakely....@gmail.com> wrote: >> >> >> >> On Sat, 16 Jun 2018 at 14:06, Jonathan Wakely <jwakely....@gmail.com> wrote: >>> >>> >>> >>> On Sat, 16 Jun 2018 at 02:04, Sandra Loosemore <san...@codesourcery.com> >>> wrote: >>>> >>>> On 05/31/2018 01:19 PM, Jonathan Wakely wrote: >>>> > This adds incomplete but functional support for std::filesystem and >>>> > std::experimental::filesystem on MinGW. In theory there should be no >>>> > changes to the existing behaviour for POSIX targets from this patch, >>>> > as all the various bugs I found while working on this have already >>>> > been fixed in separate patches. >>>> > >>>> > Tested powerpc64le-linux, and x86_64-w64-mingw32 (with a few expected >>>> > FAILures on mingw-w64). Committed to trunk. >>>> >>>> As noted in the issue (comment #16) 2 weeks ago already, this patch >>>> breaks libstdc++ configure on bare-metal targets. >>>> >>>> configure:80055: checking for link >>>> configure:80055: error: Link tests are not allowed after >>>> GCC_NO_EXECUTABLES. >>>> >>>> Please fix? It's blocking other people from testing unrelated patches >>>> on mainline. >>>> >>> >>> >>> I'm not the only person able to make changes to autoconf files (and already >>> said I didn't know how to fix this). >>> >>> I have a patch to replace the AC_CHECK_FUNCS line with >>> GLIBCXX_COMPILE_OR_LINK tests inside GLIBCXX_CHECK_FILESYSTEM_DEPS which >>> should work, I'll finish testing it when I get home this evening. >>> >> >> I can't build aarch64-none-elf even before my commit, so I also can't test a >> fix. >> >> checking for shl_load... configure: error: Link tests are not allowed after >> GCC_NO_EXECUTABLES. >> >> >>
diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index 4f37b6a6498..62b42d203e9 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -4314,6 +4314,7 @@ dnl and define _GLIBCXX_USE_REALPATH and _GLIBCXX_USE_UTIMENSAT. dnl AC_DEFUN([GLIBCXX_CHECK_FILESYSTEM_DEPS], [dnl dnl + if test $enable_libstdcxx_filesystem_ts = yes; then AC_LANG_SAVE AC_LANG_CPLUSPLUS ac_save_CXXFLAGS="$CXXFLAGS" @@ -4443,9 +4444,49 @@ dnl AC_DEFINE(_GLIBCXX_USE_SENDFILE, 1, [Define if sendfile is available in <sys/sendfile.h>.]) fi 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 CXXFLAGS="$ac_save_CXXFLAGS" AC_LANG_RESTORE + fi ]) dnl diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index dde1c4da944..7e1fd84606a 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -420,7 +420,6 @@ GLIBCXX_CHECK_GTHREADS # For Filesystem TS. AC_CHECK_HEADERS([fcntl.h dirent.h sys/statvfs.h utime.h]) -AC_CHECK_FUNCS(link readlink symlink) GLIBCXX_ENABLE_FILESYSTEM_TS GLIBCXX_CHECK_FILESYSTEM_DEPS