Skip to content

Commit 94ecc1f

Browse files
authored
Autotools: Sync CS for PHP_PWRITE_TEST and PHP_PREAD_TEST (php#15774)
- AS_* macros used - Arguments quoted - Cache variable ac_cv_pread renamed to php_cv_func_pread - Cache variables ac_cv_pwrite renamed to php_cv_func_pwrite
1 parent de48b90 commit 94ecc1f

File tree

2 files changed

+43
-53
lines changed

2 files changed

+43
-53
lines changed

UPGRADING.INTERNALS

+2
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
222222
- ac_cv_func_getaddrinfo -> php_cv_func_getaddrinfo
223223
- ac_cv_have_broken_gcc_strlen_opt -> php_cv_have_broken_gcc_strlen_opt
224224
- ac_cv_have_pcre2_jit -> php_cv_have_pcre2_jit
225+
- ac_cv_pread -> php_cv_func_pread
226+
- ac_cv_pwrite -> php_cv_func_pwrite
225227
- ac_cv_syscall_shadow_stack_exists -> php_cv_have_shadow_stack_syscall
226228
- ac_cv_time_r_type -> php_cv_time_r_type
227229
- ac_cv_write_stdout -> php_cv_have_write_stdout

build/php.m4

+41-53
Original file line numberDiff line numberDiff line change
@@ -1137,8 +1137,8 @@ dnl PHP_DOES_PWRITE_WORK
11371137
dnl
11381138
dnl Internal.
11391139
dnl
1140-
AC_DEFUN([PHP_DOES_PWRITE_WORK],[
1141-
AC_RUN_IFELSE([AC_LANG_SOURCE([
1140+
AC_DEFUN([PHP_DOES_PWRITE_WORK], [
1141+
AC_RUN_IFELSE([AC_LANG_SOURCE([
11421142
#include <sys/types.h>
11431143
#include <sys/stat.h>
11441144
#include <fcntl.h>
@@ -1155,23 +1155,20 @@ $1
11551155
if (pwrite(fd, "text", 4, -1) != -1 || errno != EINVAL) return 1;
11561156
return 0;
11571157
}
1158-
])],[
1159-
ac_cv_pwrite=yes
1160-
],[
1161-
ac_cv_pwrite=no
1162-
],[
1163-
ac_cv_pwrite=no
1164-
])
1158+
])],
1159+
[php_cv_func_pwrite=yes],
1160+
[php_cv_func_pwrite=no],
1161+
[php_cv_func_pwrite=no])
11651162
])
11661163

11671164
dnl
11681165
dnl PHP_DOES_PREAD_WORK
11691166
dnl
11701167
dnl Internal.
11711168
dnl
1172-
AC_DEFUN([PHP_DOES_PREAD_WORK],[
1173-
echo test > conftest_pread
1174-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1169+
AC_DEFUN([PHP_DOES_PREAD_WORK], [
1170+
echo test > conftest_pread
1171+
AC_RUN_IFELSE([AC_LANG_SOURCE([[
11751172
#include <sys/types.h>
11761173
#include <sys/stat.h>
11771174
#include <fcntl.h>
@@ -1188,61 +1185,52 @@ $1
11881185
if (pread(fd, buf, 2, -1) != -1 || errno != EINVAL) return 1;
11891186
return 0;
11901187
}
1191-
]])],[
1192-
ac_cv_pread=yes
1193-
],[
1194-
ac_cv_pread=no
1195-
],[
1196-
ac_cv_pread=no
1197-
])
1188+
]])],
1189+
[php_cv_func_pread=yes],
1190+
[php_cv_func_pread=no],
1191+
[php_cv_func_pread=no])
11981192
])
11991193

12001194
dnl
12011195
dnl PHP_PWRITE_TEST
12021196
dnl
1203-
AC_DEFUN([PHP_PWRITE_TEST],[
1204-
AC_CACHE_CHECK(whether pwrite works,ac_cv_pwrite,[
1205-
PHP_DOES_PWRITE_WORK
1206-
if test "$ac_cv_pwrite" = "no"; then
1207-
PHP_DOES_PWRITE_WORK([ssize_t pwrite(int, void *, size_t, off64_t);])
1208-
if test "$ac_cv_pwrite" = "yes"; then
1209-
ac_cv_pwrite=64
1210-
fi
1211-
fi
1197+
AC_DEFUN([PHP_PWRITE_TEST], [
1198+
AC_CACHE_CHECK([whether pwrite works], [php_cv_func_pwrite], [
1199+
PHP_DOES_PWRITE_WORK
1200+
AS_VAR_IF([php_cv_func_pwrite], [no], [
1201+
PHP_DOES_PWRITE_WORK([ssize_t pwrite(int, void *, size_t, off64_t);])
1202+
AS_VAR_IF([php_cv_func_pwrite], [yes], [php_cv_func_pwrite=64])
12121203
])
1204+
])
12131205
1214-
if test "$ac_cv_pwrite" != "no"; then
1215-
AC_DEFINE([HAVE_PWRITE], [1],
1216-
[Define to 1 if you have the 'pwrite' function.])
1217-
if test "$ac_cv_pwrite" = "64"; then
1218-
AC_DEFINE([PHP_PWRITE_64], [1],
1219-
[Define to 1 if 'pwrite' declaration with 'off64_t' is missing.])
1220-
fi
1221-
fi
1206+
AS_VAR_IF([php_cv_func_pwrite], [no],, [
1207+
AC_DEFINE([HAVE_PWRITE], [1],
1208+
[Define to 1 if you have the 'pwrite' function.])
1209+
AS_VAR_IF([php_cv_func_pwrite], [64],
1210+
[AC_DEFINE([PHP_PWRITE_64], [1],
1211+
[Define to 1 if 'pwrite' declaration with 'off64_t' is missing.])])
1212+
])
12221213
])
12231214

12241215
dnl
12251216
dnl PHP_PREAD_TEST
12261217
dnl
1227-
AC_DEFUN([PHP_PREAD_TEST],[
1228-
AC_CACHE_CHECK(whether pread works,ac_cv_pread,[
1229-
PHP_DOES_PREAD_WORK
1230-
if test "$ac_cv_pread" = "no"; then
1231-
PHP_DOES_PREAD_WORK([ssize_t pread(int, void *, size_t, off64_t);])
1232-
if test "$ac_cv_pread" = "yes"; then
1233-
ac_cv_pread=64
1234-
fi
1235-
fi
1218+
AC_DEFUN([PHP_PREAD_TEST], [
1219+
AC_CACHE_CHECK([whether pread works], [php_cv_func_pread], [
1220+
PHP_DOES_PREAD_WORK
1221+
AS_VAR_IF([php_cv_func_pread], [no], [
1222+
PHP_DOES_PREAD_WORK([ssize_t pread(int, void *, size_t, off64_t);])
1223+
AS_VAR_IF([php_cv_func_pread], [yes], [php_cv_func_pread=64])
12361224
])
1225+
])
12371226
1238-
if test "$ac_cv_pread" != "no"; then
1239-
AC_DEFINE([HAVE_PREAD], [1],
1240-
[Define to 1 if you have the 'pread' function.])
1241-
if test "$ac_cv_pread" = "64"; then
1242-
AC_DEFINE([PHP_PREAD_64], [1],
1243-
[Define to 1 if 'pread' declaration with 'off64_t' is missing.])
1244-
fi
1245-
fi
1227+
AS_VAR_IF([php_cv_func_pread], [no],, [
1228+
AC_DEFINE([HAVE_PREAD], [1],
1229+
[Define to 1 if you have the 'pread' function.])
1230+
AS_VAR_IF([php_cv_func_pread], [64],
1231+
[AC_DEFINE([PHP_PREAD_64], [1],
1232+
[Define to 1 if 'pread' declaration with 'off64_t' is missing.])])
1233+
])
12461234
])
12471235

12481236
dnl

0 commit comments

Comments
 (0)