Skip to content

Commit 1a126c5

Browse files
authored
Autotools: Normalize flags arguments (#15671)
This is a follow up of 7edb9a0 that provides passing compilation options to PHP_NEW_EXTENSION, PHP_ADD_SOURCES, PHP_ADD_SOURCES_X, and PHP_SELECT_SAPI as a blank-or-newline-separated argument.
1 parent 0f8259e commit 1a126c5

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
192192
- M4 macro PHP_ADD_BUILD_DIR now also accepts 1st argument as a
193193
blank-or-newline-separated separated list.
194194
- M4 macros PHP_NEW_EXTENSION, PHP_ADD_SOURCES, PHP_ADD_SOURCES_X,
195-
PHP_SELECT_SAPI now have the source files arguments normalized so the list
196-
of files can be passed as blank-or-newline-separated list (including
197-
newlines, backslash-then-newline, or any sequence of spaces or tabs).
195+
PHP_SELECT_SAPI now have the source files and flags arguments normalized so
196+
the list of items can be passed as a blank-or-newline-separated list.
198197
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed.
199198
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
200199
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and

build/php.m4

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -270,10 +270,10 @@ dnl Append to the array which has been dynamically chosen at m4 time.
270270
271271
dnl Choose the right compiler/flags/etc. for the source-file.
272272
case $ac_src in
273-
*.c[)] ac_comp="$b_c_pre $ac_inc $b_c_meta $3 -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_c_post" ;;
274-
*.s[)] ac_comp="$b_c_pre $ac_inc $b_c_meta $3 -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_c_post" ;;
275-
*.S[)] ac_comp="$b_c_pre $ac_inc $b_c_meta $3 -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_c_post" ;;
276-
*.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $ac_inc $b_cxx_meta $3 -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_cxx_post" ;;
273+
*.c[)] ac_comp="$b_c_pre $ac_inc $b_c_meta m4_normalize(m4_expand([$3])) -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_c_post" ;;
274+
*.s[)] ac_comp="$b_c_pre $ac_inc $b_c_meta m4_normalize(m4_expand([$3])) -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_c_post" ;;
275+
*.S[)] ac_comp="$b_c_pre $ac_inc $b_c_meta m4_normalize(m4_expand([$3])) -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_c_post" ;;
276+
*.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $ac_inc $b_cxx_meta m4_normalize(m4_expand([$3])) -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $b_cxx_post" ;;
277277
esac
278278
279279
dnl Generate Makefiles with dependencies
@@ -953,7 +953,7 @@ AC_DEFUN([PHP_NEW_EXTENSION],[
953953
ext_srcdir=[]PHP_EXT_SRCDIR()
954954
ext_dir=[]PHP_EXT_DIR()
955955
956-
ifelse($5,,ac_extra=,[ac_extra=$(echo "$5"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g)])
956+
ifelse($5,,ac_extra=,[ac_extra=$(echo "m4_normalize(m4_expand([$5]))"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g)])
957957
958958
if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
959959
dnl ---------------------------------------------- Static module

sapi/apache2handler/config.m4

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,6 @@ if test "$PHP_APXS2" != "no"; then
5353
AS_CASE([$flag], [-D*], [APACHE_CPPFLAGS="$APACHE_CPPFLAGS $flag"])
5454
done
5555

56-
APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
57-
5856
dnl Check Apache version.
5957
PHP_AP_EXTRACT_VERSION([$APXS_HTTPD])
6058
AS_VERSION_COMPARE([$APACHE_VERSION], [2004000],
@@ -104,7 +102,13 @@ if test "$PHP_APXS2" != "no"; then
104102
PHP_SELECT_SAPI([apache2handler],
105103
[$php_sapi_apache2handler_type],
106104
[mod_php.c sapi_apache2.c apache_config.c php_functions.c],
107-
[$APACHE_CFLAGS])
105+
[
106+
$APACHE_CPPFLAGS
107+
-I$APXS_INCLUDEDIR
108+
$APR_CFLAGS
109+
$APU_CFLAGS
110+
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1
111+
])
108112

109113
AS_IF([$APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes' >/dev/null 2>&1], [
110114
APACHE_THREADED_MPM=yes

sapi/fpm/config.m4

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,8 +526,6 @@ if test "$PHP_FPM" != "no"; then
526526
[AS_IF([test -f "$abs_srcdir/sapi/fpm/fpm/fpm_trace_$fpm_trace_type.c"],
527527
[PHP_FPM_TRACE_FILES="fpm/fpm_trace.c fpm/fpm_trace_$fpm_trace_type.c"])])
528528

529-
PHP_FPM_CFLAGS="-I$abs_srcdir/sapi/fpm -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"
530-
531529
PHP_FPM_FILES="fpm/fpm.c \
532530
fpm/fpm_children.c \
533531
fpm/fpm_cleanup.c \
@@ -560,7 +558,7 @@ if test "$PHP_FPM" != "no"; then
560558
PHP_SELECT_SAPI([fpm],
561559
[program],
562560
[$PHP_FPM_FILES $PHP_FPM_TRACE_FILES $PHP_FPM_SD_FILES],
563-
[$PHP_FPM_CFLAGS])
561+
[-I$abs_srcdir/sapi/fpm -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
564562

565563
AS_CASE([$host_alias],
566564
[*aix*], [

0 commit comments

Comments
 (0)