Skip to content

Commit b0091c4

Browse files
authored
Autotools: Sync CS in opcache extension (#15340)
- AS_* macros used - Overquoted AC_RUN_IFELSE macros arguments reduced - Redundant double quoted single variables assignments removed - i*86 and x86* patterns joined into a single case
1 parent 8c2ebc0 commit b0091c4

File tree

1 file changed

+28
-35
lines changed

1 file changed

+28
-35
lines changed

ext/opcache/config.m4

Lines changed: 28 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,28 @@ PHP_ARG_WITH([capstone],
2626
[no])
2727

2828
if test "$PHP_OPCACHE" != "no"; then
29-
3029
dnl Always build as shared extension
3130
ext_shared=yes
3231

3332
AS_VAR_IF([PHP_HUGE_CODE_PAGES], [yes],
3433
[AC_DEFINE([HAVE_HUGE_CODE_PAGES], [1],
3534
[Define to 1 to enable copying PHP CODE pages into HUGE PAGES.])])
3635

37-
if test "$PHP_OPCACHE_JIT" = "yes"; then
38-
case $host_cpu in
39-
i[[34567]]86*|x86*|aarch64|amd64)
40-
;;
41-
*)
36+
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
37+
AS_CASE([$host_cpu],
38+
[[i[34567]86*|x86*|aarch64|amd64]], [],
39+
[
4240
AC_MSG_WARN([JIT not supported by host architecture])
4341
PHP_OPCACHE_JIT=no
44-
;;
45-
esac
42+
])
43+
4644
if test "$host_vendor" = "apple" && test "$host_cpu" = "aarch64" && test "$PHP_THREAD_SAFETY" = "yes"; then
4745
AC_MSG_WARN([JIT not supported on Apple Silicon with ZTS])
4846
PHP_OPCACHE_JIT=no
4947
fi
50-
fi
48+
])
5149

52-
if test "$PHP_OPCACHE_JIT" = "yes" ; then
50+
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
5351
AC_DEFINE([HAVE_JIT], [1], [Define to 1 to enable JIT.])
5452
ZEND_JIT_SRC=m4_normalize(["
5553
jit/ir/ir_cfg.c
@@ -70,30 +68,25 @@ if test "$PHP_OPCACHE" != "no"; then
7068
"])
7169
7270
dnl Find out which ABI we are using.
73-
case $host_alias in
74-
x86_64-*-darwin*)
71+
AS_CASE([$host_alias],
72+
[x86_64-*-darwin*], [
7573
IR_TARGET=IR_TARGET_X64
7674
DASM_FLAGS="-D X64APPLE=1 -D X64=1"
7775
DASM_ARCH="x86"
78-
;;
79-
*x86_64*|amd64-*-freebsd*)
76+
],
77+
[*x86_64*|amd64-*-freebsd*], [
8078
IR_TARGET=IR_TARGET_X64
8179
DASM_FLAGS="-D X64=1"
8280
DASM_ARCH="x86"
83-
;;
84-
i[[34567]]86*)
85-
IR_TARGET=IR_TARGET_X86
86-
DASM_ARCH="x86"
87-
;;
88-
x86*)
81+
],
82+
[[i[34567]86*|x86*]], [
8983
IR_TARGET=IR_TARGET_X86
9084
DASM_ARCH="x86"
91-
;;
92-
aarch64*)
85+
],
86+
[aarch64*], [
9387
IR_TARGET=IR_TARGET_AARCH64
9488
DASM_ARCH="aarch64"
95-
;;
96-
esac
89+
])
9790
9891
AS_VAR_IF([PHP_CAPSTONE], [yes],
9992
[PKG_CHECK_MODULES([CAPSTONE], [capstone >= 3.0.0], [
@@ -109,12 +102,12 @@ if test "$PHP_OPCACHE" != "no"; then
109102
110103
JIT_CFLAGS="-I@ext_builddir@/jit/ir -D$IR_TARGET -DIR_PHP"
111104
AS_VAR_IF([ZEND_DEBUG], [yes], [JIT_CFLAGS="$JIT_CFLAGS -DIR_DEBUG"])
112-
fi
105+
])
113106

114107
AC_CHECK_FUNCS([mprotect shm_create_largepage])
115108

116109
AC_CACHE_CHECK([for sysvipc shared memory support], [php_cv_shm_ipc],
117-
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
110+
[AC_RUN_IFELSE([AC_LANG_SOURCE([
118111
#include <sys/types.h>
119112
#include <sys/wait.h>
120113
#include <sys/ipc.h>
@@ -178,7 +171,7 @@ int main(void) {
178171
}
179172
return 0;
180173
}
181-
]])],
174+
])],
182175
[php_cv_shm_ipc=yes],
183176
[php_cv_shm_ipc=no],
184177
[php_cv_shm_ipc=no])])
@@ -188,7 +181,7 @@ AS_VAR_IF([php_cv_shm_ipc], [yes],
188181

189182
AC_CACHE_CHECK([for mmap() using MAP_ANON shared memory support],
190183
[php_cv_shm_mmap_anon],
191-
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
184+
[AC_RUN_IFELSE([AC_LANG_SOURCE([
192185
#include <sys/types.h>
193186
#include <sys/wait.h>
194187
#include <sys/mman.h>
@@ -234,7 +227,7 @@ int main(void) {
234227
}
235228
return 0;
236229
}
237-
]])],
230+
])],
238231
[php_cv_shm_mmap_anon=yes],
239232
[php_cv_shm_mmap_anon=no],
240233
[AS_CASE([$host_alias],
@@ -248,7 +241,7 @@ AS_VAR_IF([php_cv_shm_mmap_anon], [yes],
248241
dnl needed: rt (older Linux and Solaris <= 10). Most systems have it in the C
249242
dnl standard library (newer Linux, illumos, Solaris 11.4, macOS, BSD-based
250243
dnl systems...). Haiku has it in the root library, which is linked by default.
251-
LIBS_save="$LIBS"
244+
LIBS_save=$LIBS
252245
LIBS=
253246
AC_SEARCH_LIBS([shm_open], [rt],
254247
[AC_CACHE_CHECK([for mmap() using shm_open() shared memory support],
@@ -321,14 +314,14 @@ int main(void) {
321314
[php_cv_shm_mmap_posix=no])
322315
])
323316
324-
if test "$php_cv_shm_mmap_posix" = "yes"; then
317+
AS_VAR_IF([php_cv_shm_mmap_posix], [yes], [
325318
AS_VAR_IF([ac_cv_search_shm_open], ["none required"],,
326319
[OPCACHE_SHARED_LIBADD="$OPCACHE_SHARED_LIBADD $ac_cv_search_shm_open"])
327320
AC_DEFINE([HAVE_SHM_MMAP_POSIX], [1],
328321
[Define to 1 if you have the POSIX mmap() SHM support.])
329-
fi
322+
])
330323
])
331-
LIBS="$LIBS_save"
324+
LIBS=$LIBS_save
332325

333326
PHP_NEW_EXTENSION([opcache], m4_normalize([
334327
shared_alloc_mmap.c
@@ -356,10 +349,10 @@ int main(void) {
356349
AC_MSG_FAILURE([No supported shared memory caching support was found when configuring opcache.])
357350
fi
358351

359-
if test "$PHP_OPCACHE_JIT" = "yes"; then
352+
AS_VAR_IF([PHP_OPCACHE_JIT], [yes], [
360353
PHP_ADD_BUILD_DIR([$ext_builddir/jit])
361354
PHP_ADD_BUILD_DIR([$ext_builddir/jit/ir])
362355
PHP_ADD_MAKEFILE_FRAGMENT([$ext_srcdir/jit/Makefile.frag])
363-
fi
356+
])
364357
PHP_SUBST([OPCACHE_SHARED_LIBADD])
365358
fi

0 commit comments

Comments
 (0)