aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/configure
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2019-01-07 12:38:51 +0000
committerJonathan Wakely <redi@gcc.gnu.org>2019-01-07 12:38:51 +0000
commitcf4b581f2e28368c01fe93792ebc6eefb2bc8116 (patch)
treee97aa3a3f62308d35f617bfdfd0d7cc819e035dd /libstdc++-v3/configure
parentf4bf2aabe36633d75852313caafe7efab71d5ba7 (diff)
downloadgcc-cf4b581f2e28368c01fe93792ebc6eefb2bc8116.zip
gcc-cf4b581f2e28368c01fe93792ebc6eefb2bc8116.tar.gz
gcc-cf4b581f2e28368c01fe93792ebc6eefb2bc8116.tar.bz2
Fix build for systems without POSIX truncate
Older versions of newlib do not provide truncate so add a configure check for it, and provide a fallback definition. There were also some missing exports in the linker script, which went unnoticed because there are no tests for some functions. A new link-only test checks that every filesystem operation function is defined by the library. * acinclude.m4 (GLIBCXX_CHECK_FILESYSTEM_DEPS): Check for truncate. * config.h.in: Regenerate. * config/abi/pre/gnu.ver: Order patterns for filesystem operations alphabetically and add missing entries for copy_symlink, hard_link_count, rename, and resize_file. * configure: Regenerate. * src/c++17/fs_ops.cc (resize_file): Remove #if so posix::truncate is used unconditionally. * src/filesystem/ops-common.h (__gnu_posix::truncate) [!_GLIBCXX_HAVE_TRUNCATE]: Provide fallback definition that only supports truncating to zero length. * testsuite/27_io/filesystem/operations/all.cc: New test. * testsuite/27_io/filesystem/operations/resize_file.cc: New test. From-SVN: r267647
Diffstat (limited to 'libstdc++-v3/configure')
-rwxr-xr-xlibstdc++-v3/configure56
1 files changed, 56 insertions, 0 deletions
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index e01d900..15848e3 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -81038,6 +81038,62 @@ $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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for truncate" >&5
+$as_echo_n "checking for truncate... " >&6; }
+ if ${glibcxx_cv_truncate+:} false; 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 ()
+{
+truncate("", 99);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ glibcxx_cv_truncate=yes
+else
+ glibcxx_cv_truncate=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 ()
+{
+truncate("", 99);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ glibcxx_cv_truncate=yes
+else
+ glibcxx_cv_truncate=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+
+fi
+
+ if test $glibcxx_cv_truncate = yes; then
+
+$as_echo "#define HAVE_TRUNCATE 1" >>confdefs.h
+
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_truncate" >&5
+$as_echo "$glibcxx_cv_truncate" >&6; }
CXXFLAGS="$ac_save_CXXFLAGS"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'