aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/configure
diff options
context:
space:
mode:
authorJannik Glückert <jannik.glueckert@gmail.com>2023-03-06 20:52:08 +0100
committerJonathan Wakely <jwakely@redhat.com>2023-06-06 12:31:57 +0100
commitf80a8b42296265bb868a48592a2bd1fdaa2a3d8a (patch)
tree40054d92f4a3a9d0b5c2ece3bd68124a0006f62d /libstdc++-v3/configure
parentc4deccd44655c5d748dfed200a37f2b678c32fe8 (diff)
downloadgcc-f80a8b42296265bb868a48592a2bd1fdaa2a3d8a.zip
gcc-f80a8b42296265bb868a48592a2bd1fdaa2a3d8a.tar.gz
gcc-f80a8b42296265bb868a48592a2bd1fdaa2a3d8a.tar.bz2
libstdc++: Also use sendfile for big files
We were previously only using sendfile for files smaller than 2GB, as sendfile needs to be called repeatedly for files bigger than that. Some quick numbers, copying a 16GB file, average of 10 repetitions: old: real: 13.4s user: 0.14s sys : 7.43s new: real: 8.90s user: 0.00s sys : 3.68s libstdc++-v3/ChangeLog: * acinclude.m4 (_GLIBCXX_HAVE_LSEEK): Define. * config.h.in: Regenerate. * configure: Regenerate. * src/filesystem/ops-common.h (copy_file_sendfile): Define new function for sendfile logic. Loop to support large files. Skip zero-length files. (do_copy_file): Use it. Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
Diffstat (limited to 'libstdc++-v3/configure')
-rwxr-xr-xlibstdc++-v3/configure127
1 files changed, 91 insertions, 36 deletions
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 70d169c..50a7c30 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -71005,29 +71005,27 @@ $as_echo "$glibcxx_cv_fchmodat" >&6; }
$as_echo "#define _GLIBCXX_USE_FCHMODAT 1" >>confdefs.h
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile that can copy files" >&5
-$as_echo_n "checking for sendfile that can copy files... " >&6; }
-if ${glibcxx_cv_sendfile+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for link" >&5
+$as_echo_n "checking for link... " >&6; }
+if ${glibcxx_cv_link+:} false; then :
$as_echo_n "(cached) " >&6
else
- case "${target_os}" in
- gnu* | linux* | solaris* | uclinux*)
- if test x$gcc_no_link = xyes; then
+ if test x$gcc_no_link = xyes; then
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <sys/sendfile.h>
+#include <unistd.h>
int
main ()
{
-sendfile(1, 2, (off_t*)0, sizeof 1);
+link("", "");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
- glibcxx_cv_sendfile=yes
+ glibcxx_cv_link=yes
else
- glibcxx_cv_sendfile=no
+ glibcxx_cv_link=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
@@ -71036,40 +71034,35 @@ else
fi
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <sys/sendfile.h>
+#include <unistd.h>
int
main ()
{
-sendfile(1, 2, (off_t*)0, sizeof 1);
+link("", "");
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
- glibcxx_cv_sendfile=yes
+ glibcxx_cv_link=yes
else
- glibcxx_cv_sendfile=no
+ glibcxx_cv_link=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
- ;;
- *)
- glibcxx_cv_sendfile=no
- ;;
- esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sendfile" >&5
-$as_echo "$glibcxx_cv_sendfile" >&6; }
- if test $glibcxx_cv_sendfile = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_link" >&5
+$as_echo "$glibcxx_cv_link" >&6; }
+ if test $glibcxx_cv_link = yes; then
-$as_echo "#define _GLIBCXX_USE_SENDFILE 1" >>confdefs.h
+$as_echo "#define HAVE_LINK 1" >>confdefs.h
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for link" >&5
-$as_echo_n "checking for link... " >&6; }
-if ${glibcxx_cv_link+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lseek" >&5
+$as_echo_n "checking for lseek... " >&6; }
+if ${glibcxx_cv_lseek+:} false; then :
$as_echo_n "(cached) " >&6
else
if test x$gcc_no_link = xyes; then
@@ -71079,15 +71072,15 @@ else
int
main ()
{
-link("", "");
+lseek(1, 0, SEEK_SET);
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_compile "$LINENO"; then :
- glibcxx_cv_link=yes
+ glibcxx_cv_lseek=yes
else
- glibcxx_cv_link=no
+ glibcxx_cv_lseek=no
fi
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
@@ -71100,26 +71093,26 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
int
main ()
{
-link("", "");
+lseek(1, 0, SEEK_SET);
;
return 0;
}
_ACEOF
if ac_fn_cxx_try_link "$LINENO"; then :
- glibcxx_cv_link=yes
+ glibcxx_cv_lseek=yes
else
- glibcxx_cv_link=no
+ glibcxx_cv_lseek=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_link" >&5
-$as_echo "$glibcxx_cv_link" >&6; }
- if test $glibcxx_cv_link = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_lseek" >&5
+$as_echo "$glibcxx_cv_lseek" >&6; }
+ if test $glibcxx_cv_lseek = yes; then
-$as_echo "#define HAVE_LINK 1" >>confdefs.h
+$as_echo "#define HAVE_LSEEK 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for readlink" >&5
@@ -71287,6 +71280,68 @@ $as_echo "$glibcxx_cv_truncate" >&6; }
$as_echo "#define HAVE_TRUNCATE 1" >>confdefs.h
fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sendfile that can copy files" >&5
+$as_echo_n "checking for sendfile that can copy files... " >&6; }
+if ${glibcxx_cv_sendfile+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ case "${target_os}" in
+ gnu* | linux* | solaris* | uclinux*)
+ if test x$gcc_no_link = xyes; then
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/sendfile.h>
+int
+main ()
+{
+sendfile(1, 2, (off_t*)0, sizeof 1);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ glibcxx_cv_sendfile=yes
+else
+ glibcxx_cv_sendfile=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 <sys/sendfile.h>
+int
+main ()
+{
+sendfile(1, 2, (off_t*)0, sizeof 1);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ glibcxx_cv_sendfile=yes
+else
+ glibcxx_cv_sendfile=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ ;;
+ *)
+ glibcxx_cv_sendfile=no
+ ;;
+ esac
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $glibcxx_cv_sendfile" >&5
+$as_echo "$glibcxx_cv_sendfile" >&6; }
+ if test $glibcxx_cv_sendfile = yes && test $glibcxx_cv_lseek = yes; then
+
+$as_echo "#define _GLIBCXX_USE_SENDFILE 1" >>confdefs.h
+
+ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fdopendir" >&5
$as_echo_n "checking for fdopendir... " >&6; }
if ${glibcxx_cv_fdopendir+:} false; then :