@@ -364,7 +364,6 @@ PHP_CHECK_FUNC(socketpair, socket, network)
364
364
PHP_CHECK_FUNC(htonl, socket, network)
365
365
PHP_CHECK_FUNC(gethostname, nsl, network)
366
366
PHP_CHECK_FUNC(gethostbyaddr, nsl, network)
367
- PHP_CHECK_FUNC(copy_file_range)
368
367
PHP_CHECK_FUNC(dlopen, dl, root)
369
368
PHP_CHECK_FUNC(dlsym, dl, root)
370
369
if test "$ac_cv_func_dlopen" = "yes"; then
@@ -691,6 +690,39 @@ if test "$ac_cv_func_getaddrinfo" = yes; then
691
690
AC_DEFINE ( HAVE_GETADDRINFO ,1 ,[ Define if you have the getaddrinfo function] )
692
691
fi
693
692
693
+ AC_CACHE_CHECK ( [ for copy_file_range] , ac_cv_copy_file_range ,
694
+ [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
695
+ #if defined(__linux__)
696
+ #if !defined(_GNU_SOURCE)
697
+ #define _GNU_SOURCE
698
+ #endif
699
+ #include <linux/version.h>
700
+ #elif defined(__FreeBSD__)
701
+ // TODO checks kernel version once this syscall is fixed on FreeBSD
702
+ #include <sys/param.h>
703
+ #include <sys/types.h>
704
+ #endif
705
+ #include <unistd.h>
706
+
707
+ int main(void) {
708
+ (void)copy_file_range(-1, 0, -1, 0, 0, 0);
709
+ #if defined(__linux__)
710
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0)
711
+ return 1;
712
+ #else
713
+ return 0;
714
+ #endif
715
+ #else
716
+ return 1;
717
+ #endif
718
+ }
719
+ ] ] ) ] , [ ac_cv_copy_file_range=yes] , [ ac_cv_copy_file_range=no] )
720
+ ] )
721
+
722
+ if test "$ac_cv_copy_file_range" = yes; then
723
+ AC_DEFINE ( HAVE_COPY_FILE_RANGE ,1 ,[ Define if copy_file_range support] )
724
+ fi
725
+
694
726
AC_REPLACE_FUNCS ( strlcat strlcpy explicit_bzero getopt )
695
727
AC_FUNC_ALLOCA
696
728
PHP_TIME_R_TYPE
0 commit comments