diff mbox series

[committed] libstdc++: Make C++17 ignore --disable-libstdcxx-filesystem-ts [PR 94681]

Message ID 20200810122403.GA2932346@redhat.com
State New
Headers show
Series [committed] libstdc++: Make C++17 ignore --disable-libstdcxx-filesystem-ts [PR 94681] | expand

Commit Message

Jonathan Wakely Aug. 10, 2020, 12:24 p.m. UTC
The configure switch should only affect the optional Filesystem TS, not
the std::filesystem features of C++17.

libstdc++-v3/ChangeLog:

	PR libstdc++/94681
	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Do not depend on
	$enable_libstdcxx_filesystem_ts.
	* configure: Regenerate.

Tested powerpc64le-linux. Committed to trunk.

The patch looks fairly large, but the only non-whitespace changes are:


The rest is just re-indenting the body of that macro.
commit 90f7636bf8df50940e0f749af60a6b374a8f09b4
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Aug 10 13:21:59 2020

    libstdc++: Make C++17 ignore --disable-libstdcxx-filesystem-ts [PR 94681]
    
    The configure switch should only affect the optional Filesystem TS, not
    the std::filesystem features of C++17.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/94681
            * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Do not depend on
            $enable_libstdcxx_filesystem_ts.
            * configure: Regenerate.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index e3926e1c9c2..26cf2197549 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -4536,7 +4536,8 @@ AC_DEFUN([GLIBCXX_ENABLE_FILESYSTEM_TS], [
 ])
 
 dnl
-dnl Check whether the library calls required by the Filesystem TS are present.
+dnl Check whether the library calls required by the C++17 Filesystem library
+dnl and the Filesystem TS are present.
 dnl Defines:
 dnl  HAVE_STRUCT_DIRENT_D_TYPE
 dnl  _GLIBCXX_USE_REALPATH
@@ -4551,226 +4552,224 @@ dnl  HAVE_SYMLINK
 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"
-    CXXFLAGS="$CXXFLAGS -fno-exceptions"
+  AC_LANG_SAVE
+  AC_LANG_CPLUSPLUS
+  ac_save_CXXFLAGS="$CXXFLAGS"
+  CXXFLAGS="$CXXFLAGS -fno-exceptions"
 dnl
-    AC_MSG_CHECKING([for struct dirent.d_type])
-    AC_CACHE_VAL(glibcxx_cv_dirent_d_type, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [#include <dirent.h>],
-        [
-         struct dirent d;
-         if (sizeof d.d_type) return 0;
-        ],
-        [glibcxx_cv_dirent_d_type=yes],
-        [glibcxx_cv_dirent_d_type=no])
-    ])
-    if test $glibcxx_cv_dirent_d_type = yes; then
-      AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1, [Define to 1 if `d_type' is a member of `struct dirent'.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_dirent_d_type)
-dnl
-    AC_MSG_CHECKING([for realpath])
-    AC_CACHE_VAL(glibcxx_cv_realpath, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [
-         #include <limits.h>
-         #include <stdlib.h>
-         #include <unistd.h>
-        ],
-        [
-         #if _XOPEN_VERSION < 500
-         #error
-         #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX)
-         char *tmp = realpath((const char*)NULL, (char*)NULL);
-         #else
-         #error
-         #endif
-        ],
-        [glibcxx_cv_realpath=yes],
-        [glibcxx_cv_realpath=no])
-    ])
-    if test $glibcxx_cv_realpath = yes; then
-      AC_DEFINE(_GLIBCXX_USE_REALPATH, 1, [Define if usable realpath is available in <stdlib.h>.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_realpath)
-dnl
-    AC_MSG_CHECKING([for utimensat])
-    AC_CACHE_VAL(glibcxx_cv_utimensat, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [
-          #include <fcntl.h>
-          #include <sys/stat.h>
-        ],
-        [
-          struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } };
-          int i = utimensat(AT_FDCWD, "path", ts, 0);
-        ],
-        [glibcxx_cv_utimensat=yes],
-        [glibcxx_cv_utimensat=no])
-    ])
-    if test $glibcxx_cv_utimensat = yes; then
-      AC_DEFINE(_GLIBCXX_USE_UTIMENSAT, 1, [Define if utimensat and UTIME_OMIT are available in <sys/stat.h> and AT_FDCWD in <fcntl.h>.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_utimensat)
-dnl
-    AC_MSG_CHECKING([for utime])
-    AC_CACHE_VAL(glibcxx_cv_utime, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [
-          #include <utime.h>
-        ],
-        [
-          struct utimbuf t = { 1, 1 };
-          int i = utime("path", &t);
-        ],
-        [glibcxx_cv_utime=yes],
-        [glibcxx_cv_utime=no])
-    ])
-    if test $glibcxx_cv_utime = yes; then
-      AC_DEFINE(_GLIBCXX_USE_UTIME, 1, [Define if utime is available in <utime.h>.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_utime)
-dnl
-    AC_MSG_CHECKING([for lstat])
-    AC_CACHE_VAL(glibcxx_cv_lstat, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [ #include <sys/stat.h> ],
-        [
-          struct stat st;
-          int i = lstat("path", &st);
-        ],
-        [glibcxx_cv_lstat=yes],
-        [glibcxx_cv_lstat=no])
-    ])
-    if test $glibcxx_cv_lstat = yes; then
-      AC_DEFINE(_GLIBCXX_USE_LSTAT, 1, [Define if lstat is available in <sys/stat.h>.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_lstat)
-dnl
-    AC_MSG_CHECKING([for struct stat.st_mtim.tv_nsec])
-    AC_CACHE_VAL(glibcxx_cv_st_mtim, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [ #include <sys/stat.h> ],
-        [
-          struct stat st;
-          return st.st_mtim.tv_nsec;
-        ],
-        [glibcxx_cv_st_mtim=yes],
-        [glibcxx_cv_st_mtim=no])
-    ])
-    if test $glibcxx_cv_st_mtim = yes; then
-      AC_DEFINE(_GLIBCXX_USE_ST_MTIM, 1, [Define if struct stat has timespec members.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_st_mtim)
-dnl
-    AC_MSG_CHECKING([for fchmod])
-    AC_CACHE_VAL(glibcxx_cv_fchmod, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [#include <sys/stat.h>],
-        [fchmod(1, S_IWUSR);],
-        [glibcxx_cv_fchmod=yes],
-        [glibcxx_cv_fchmod=no])
-    ])
-    if test $glibcxx_cv_fchmod = yes; then
-      AC_DEFINE(_GLIBCXX_USE_FCHMOD, 1, [Define if fchmod is available in <sys/stat.h>.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_fchmod)
-dnl
-    AC_MSG_CHECKING([for fchmodat])
-    AC_CACHE_VAL(glibcxx_cv_fchmodat, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [
-          #include <fcntl.h>
-          #include <sys/stat.h>
-        ],
-        [fchmodat(AT_FDCWD, "", 0, AT_SYMLINK_NOFOLLOW);],
-        [glibcxx_cv_fchmodat=yes],
-        [glibcxx_cv_fchmodat=no])
-    ])
-    if test $glibcxx_cv_fchmodat = yes; then
-      AC_DEFINE(_GLIBCXX_USE_FCHMODAT, 1, [Define if fchmodat is available in <sys/stat.h>.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_fchmodat)
-dnl
-    AC_MSG_CHECKING([for sendfile that can copy files])
-    AC_CACHE_VAL(glibcxx_cv_sendfile, [dnl
-      case "${target_os}" in
-        gnu* | linux* | solaris* | uclinux*)
-          GCC_TRY_COMPILE_OR_LINK(
-            [#include <sys/sendfile.h>],
-            [sendfile(1, 2, (off_t*)0, sizeof 1);],
-            [glibcxx_cv_sendfile=yes],
-            [glibcxx_cv_sendfile=no])
-          ;;
-        *)
-          glibcxx_cv_sendfile=no
-          ;;
-      esac
-    ])
-    if test $glibcxx_cv_sendfile = yes; then
-      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
-    AC_MSG_CHECKING([for truncate])
-    AC_CACHE_VAL(glibcxx_cv_truncate, [dnl
-      GCC_TRY_COMPILE_OR_LINK(
-        [#include <unistd.h>],
-        [truncate("", 99);],
-        [glibcxx_cv_truncate=yes],
-        [glibcxx_cv_truncate=no])
-    ])
-    if test $glibcxx_cv_truncate = yes; then
-      AC_DEFINE(HAVE_TRUNCATE, 1, [Define if truncate is available in <unistd.h>.])
-    fi
-    AC_MSG_RESULT($glibcxx_cv_truncate)
-dnl
-    CXXFLAGS="$ac_save_CXXFLAGS"
-    AC_LANG_RESTORE
+  AC_MSG_CHECKING([for struct dirent.d_type])
+  AC_CACHE_VAL(glibcxx_cv_dirent_d_type, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [#include <dirent.h>],
+      [
+       struct dirent d;
+       if (sizeof d.d_type) return 0;
+      ],
+      [glibcxx_cv_dirent_d_type=yes],
+      [glibcxx_cv_dirent_d_type=no])
+  ])
+  if test $glibcxx_cv_dirent_d_type = yes; then
+    AC_DEFINE(HAVE_STRUCT_DIRENT_D_TYPE, 1, [Define to 1 if `d_type' is a member of `struct dirent'.])
   fi
+  AC_MSG_RESULT($glibcxx_cv_dirent_d_type)
+dnl
+  AC_MSG_CHECKING([for realpath])
+  AC_CACHE_VAL(glibcxx_cv_realpath, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [
+       #include <limits.h>
+       #include <stdlib.h>
+       #include <unistd.h>
+      ],
+      [
+       #if _XOPEN_VERSION < 500
+       #error
+       #elif _XOPEN_VERSION >= 700 || defined(PATH_MAX)
+       char *tmp = realpath((const char*)NULL, (char*)NULL);
+       #else
+       #error
+       #endif
+      ],
+      [glibcxx_cv_realpath=yes],
+      [glibcxx_cv_realpath=no])
+  ])
+  if test $glibcxx_cv_realpath = yes; then
+    AC_DEFINE(_GLIBCXX_USE_REALPATH, 1, [Define if usable realpath is available in <stdlib.h>.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_realpath)
+dnl
+  AC_MSG_CHECKING([for utimensat])
+  AC_CACHE_VAL(glibcxx_cv_utimensat, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [
+	#include <fcntl.h>
+	#include <sys/stat.h>
+      ],
+      [
+	struct timespec ts[2] = { { 0, UTIME_OMIT }, { 1, 1 } };
+	int i = utimensat(AT_FDCWD, "path", ts, 0);
+      ],
+      [glibcxx_cv_utimensat=yes],
+      [glibcxx_cv_utimensat=no])
+  ])
+  if test $glibcxx_cv_utimensat = yes; then
+    AC_DEFINE(_GLIBCXX_USE_UTIMENSAT, 1, [Define if utimensat and UTIME_OMIT are available in <sys/stat.h> and AT_FDCWD in <fcntl.h>.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_utimensat)
+dnl
+  AC_MSG_CHECKING([for utime])
+  AC_CACHE_VAL(glibcxx_cv_utime, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [
+	#include <utime.h>
+      ],
+      [
+	struct utimbuf t = { 1, 1 };
+	int i = utime("path", &t);
+      ],
+      [glibcxx_cv_utime=yes],
+      [glibcxx_cv_utime=no])
+  ])
+  if test $glibcxx_cv_utime = yes; then
+    AC_DEFINE(_GLIBCXX_USE_UTIME, 1, [Define if utime is available in <utime.h>.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_utime)
+dnl
+  AC_MSG_CHECKING([for lstat])
+  AC_CACHE_VAL(glibcxx_cv_lstat, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [ #include <sys/stat.h> ],
+      [
+	struct stat st;
+	int i = lstat("path", &st);
+      ],
+      [glibcxx_cv_lstat=yes],
+      [glibcxx_cv_lstat=no])
+  ])
+  if test $glibcxx_cv_lstat = yes; then
+    AC_DEFINE(_GLIBCXX_USE_LSTAT, 1, [Define if lstat is available in <sys/stat.h>.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_lstat)
+dnl
+  AC_MSG_CHECKING([for struct stat.st_mtim.tv_nsec])
+  AC_CACHE_VAL(glibcxx_cv_st_mtim, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [ #include <sys/stat.h> ],
+      [
+	struct stat st;
+	return st.st_mtim.tv_nsec;
+      ],
+      [glibcxx_cv_st_mtim=yes],
+      [glibcxx_cv_st_mtim=no])
+  ])
+  if test $glibcxx_cv_st_mtim = yes; then
+    AC_DEFINE(_GLIBCXX_USE_ST_MTIM, 1, [Define if struct stat has timespec members.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_st_mtim)
+dnl
+  AC_MSG_CHECKING([for fchmod])
+  AC_CACHE_VAL(glibcxx_cv_fchmod, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [#include <sys/stat.h>],
+      [fchmod(1, S_IWUSR);],
+      [glibcxx_cv_fchmod=yes],
+      [glibcxx_cv_fchmod=no])
+  ])
+  if test $glibcxx_cv_fchmod = yes; then
+    AC_DEFINE(_GLIBCXX_USE_FCHMOD, 1, [Define if fchmod is available in <sys/stat.h>.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_fchmod)
+dnl
+  AC_MSG_CHECKING([for fchmodat])
+  AC_CACHE_VAL(glibcxx_cv_fchmodat, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [
+	#include <fcntl.h>
+	#include <sys/stat.h>
+      ],
+      [fchmodat(AT_FDCWD, "", 0, AT_SYMLINK_NOFOLLOW);],
+      [glibcxx_cv_fchmodat=yes],
+      [glibcxx_cv_fchmodat=no])
+  ])
+  if test $glibcxx_cv_fchmodat = yes; then
+    AC_DEFINE(_GLIBCXX_USE_FCHMODAT, 1, [Define if fchmodat is available in <sys/stat.h>.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_fchmodat)
+dnl
+  AC_MSG_CHECKING([for sendfile that can copy files])
+  AC_CACHE_VAL(glibcxx_cv_sendfile, [dnl
+    case "${target_os}" in
+      gnu* | linux* | solaris* | uclinux*)
+	GCC_TRY_COMPILE_OR_LINK(
+	  [#include <sys/sendfile.h>],
+	  [sendfile(1, 2, (off_t*)0, sizeof 1);],
+	  [glibcxx_cv_sendfile=yes],
+	  [glibcxx_cv_sendfile=no])
+	;;
+      *)
+	glibcxx_cv_sendfile=no
+	;;
+    esac
+  ])
+  if test $glibcxx_cv_sendfile = yes; then
+    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
+  AC_MSG_CHECKING([for truncate])
+  AC_CACHE_VAL(glibcxx_cv_truncate, [dnl
+    GCC_TRY_COMPILE_OR_LINK(
+      [#include <unistd.h>],
+      [truncate("", 99);],
+      [glibcxx_cv_truncate=yes],
+      [glibcxx_cv_truncate=no])
+  ])
+  if test $glibcxx_cv_truncate = yes; then
+    AC_DEFINE(HAVE_TRUNCATE, 1, [Define if truncate is available in <unistd.h>.])
+  fi
+  AC_MSG_RESULT($glibcxx_cv_truncate)
+dnl
+  CXXFLAGS="$ac_save_CXXFLAGS"
+  AC_LANG_RESTORE
 ])
 
 dnl

Comments

Jonathan Wakely Aug. 10, 2020, 6:13 p.m. UTC | #1
On 10/08/20 13:24 +0100, Jonathan Wakely wrote:
>The configure switch should only affect the optional Filesystem TS, not
>the std::filesystem features of C++17.
>
>libstdc++-v3/ChangeLog:
>
>	PR libstdc++/94681
>	* acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Do not depend on
>	$enable_libstdcxx_filesystem_ts.
>	* configure: Regenerate.

This fixes a build failure reported in the PR.

Tested x86_64-linux. Committed to trunk.
diff mbox series

Patch

--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -4536,7 +4536,8 @@  AC_DEFUN([GLIBCXX_ENABLE_FILESYSTEM_TS], [
 ])

 dnl
-dnl Check whether the library calls required by the Filesystem TS are present.
+dnl Check whether the library calls required by the C++17 Filesystem library
+dnl and the Filesystem TS are present.
 dnl Defines:
 dnl  HAVE_STRUCT_DIRENT_D_TYPE
 dnl  _GLIBCXX_USE_REALPATH
@@ -4551,7 +4552,6 @@  dnl  HAVE_SYMLINK
 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"
@@ -4770,7 +4770,6 @@  dnl
 dnl
   CXXFLAGS="$ac_save_CXXFLAGS"
   AC_LANG_RESTORE
-  fi
 ])

 dnl