@@ -364,7 +364,6 @@ PHP_CHECK_FUNC(socketpair, socket, network)
364364PHP_CHECK_FUNC(htonl, socket, network)
365365PHP_CHECK_FUNC(gethostname, nsl, network)
366366PHP_CHECK_FUNC(gethostbyaddr, nsl, network)
367- PHP_CHECK_FUNC(copy_file_range)
368367PHP_CHECK_FUNC(dlopen, dl, root)
369368PHP_CHECK_FUNC(dlsym, dl, root)
370369if test "$ac_cv_func_dlopen" = "yes"; then
@@ -691,6 +690,33 @@ if test "$ac_cv_func_getaddrinfo" = yes; then
691690 AC_DEFINE ( HAVE_GETADDRINFO ,1 ,[ Define if you have the getaddrinfo function] )
692691fi
693692
693+ AC_CACHE_CHECK ( [ for copy_file_range] , ac_cv_copy_file_range ,
694+ [ AC_RUN_IFELSE ( [ AC_LANG_SOURCE ( [ [
695+ #ifdef __linux__
696+ #ifndef _GNU_SOURCE
697+ #define _GNU_SOURCE
698+ #endif
699+ #include <linux/version.h>
700+ #include <unistd.h>
701+
702+ int main(void) {
703+ (void)copy_file_range(-1, 0, -1, 0, 0, 0);
704+ #if LINUX_VERSION_CODE < KERNEL_VERSION(5,3,0)
705+ #error "kernel too old"
706+ #else
707+ return 0;
708+ #endif
709+ }
710+ #else
711+ #error "unsupported platform"
712+ #endif
713+ ] ] ) ] , [ ac_cv_copy_file_range=yes] , [ ac_cv_copy_file_range=no] )
714+ ] )
715+
716+ if test "$ac_cv_copy_file_range" = yes; then
717+ AC_DEFINE ( HAVE_COPY_FILE_RANGE ,1 ,[ Define if copy_file_range support] )
718+ fi
719+
694720AC_REPLACE_FUNCS ( strlcat strlcpy explicit_bzero getopt )
695721AC_FUNC_ALLOCA
696722PHP_TIME_R_TYPE
0 commit comments