Skip to content

Commit

Permalink
Autotools: Normalize flags arguments (#15671)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
petk committed Aug 31, 2024
1 parent 0f8259e commit 1a126c5
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
5 changes: 2 additions & 3 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
- M4 macro PHP_ADD_BUILD_DIR now also accepts 1st argument as a
blank-or-newline-separated separated list.
- M4 macros PHP_NEW_EXTENSION, PHP_ADD_SOURCES, PHP_ADD_SOURCES_X,
PHP_SELECT_SAPI now have the source files arguments normalized so the list
of files can be passed as blank-or-newline-separated list (including
newlines, backslash-then-newline, or any sequence of spaces or tabs).
PHP_SELECT_SAPI now have the source files and flags arguments normalized so
the list of items can be passed as a blank-or-newline-separated list.
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed.
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and
Expand Down
10 changes: 5 additions & 5 deletions build/php.m4
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,10 @@ dnl Append to the array which has been dynamically chosen at m4 time.
dnl Choose the right compiler/flags/etc. for the source-file.
case $ac_src in
*.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" ;;
*.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" ;;
*.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" ;;
*.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" ;;
*.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" ;;
*.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" ;;
*.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" ;;
*.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" ;;
esac
dnl Generate Makefiles with dependencies
Expand Down Expand Up @@ -953,7 +953,7 @@ AC_DEFUN([PHP_NEW_EXTENSION],[
ext_srcdir=[]PHP_EXT_SRCDIR()
ext_dir=[]PHP_EXT_DIR()
ifelse($5,,ac_extra=,[ac_extra=$(echo "$5"|$SED s#@ext_srcdir@#$ext_srcdir#g|$SED s#@ext_builddir@#$ext_builddir#g)])
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)])
if test "$3" != "shared" && test "$3" != "yes" && test "$4" != "cli"; then
dnl ---------------------------------------------- Static module
Expand Down
10 changes: 7 additions & 3 deletions sapi/apache2handler/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ if test "$PHP_APXS2" != "no"; then
AS_CASE([$flag], [-D*], [APACHE_CPPFLAGS="$APACHE_CPPFLAGS $flag"])
done

APACHE_CFLAGS="$APACHE_CPPFLAGS -I$APXS_INCLUDEDIR $APR_CFLAGS $APU_CFLAGS -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"

dnl Check Apache version.
PHP_AP_EXTRACT_VERSION([$APXS_HTTPD])
AS_VERSION_COMPARE([$APACHE_VERSION], [2004000],
Expand Down Expand Up @@ -104,7 +102,13 @@ if test "$PHP_APXS2" != "no"; then
PHP_SELECT_SAPI([apache2handler],
[$php_sapi_apache2handler_type],
[mod_php.c sapi_apache2.c apache_config.c php_functions.c],
[$APACHE_CFLAGS])
[
$APACHE_CPPFLAGS
-I$APXS_INCLUDEDIR
$APR_CFLAGS
$APU_CFLAGS
-DZEND_ENABLE_STATIC_TSRMLS_CACHE=1
])

AS_IF([$APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes' >/dev/null 2>&1], [
APACHE_THREADED_MPM=yes
Expand Down
4 changes: 1 addition & 3 deletions sapi/fpm/config.m4
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,6 @@ if test "$PHP_FPM" != "no"; then
[AS_IF([test -f "$abs_srcdir/sapi/fpm/fpm/fpm_trace_$fpm_trace_type.c"],
[PHP_FPM_TRACE_FILES="fpm/fpm_trace.c fpm/fpm_trace_$fpm_trace_type.c"])])

PHP_FPM_CFLAGS="-I$abs_srcdir/sapi/fpm -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1"

PHP_FPM_FILES="fpm/fpm.c \
fpm/fpm_children.c \
fpm/fpm_cleanup.c \
Expand Down Expand Up @@ -560,7 +558,7 @@ if test "$PHP_FPM" != "no"; then
PHP_SELECT_SAPI([fpm],
[program],
[$PHP_FPM_FILES $PHP_FPM_TRACE_FILES $PHP_FPM_SD_FILES],
[$PHP_FPM_CFLAGS])
[-I$abs_srcdir/sapi/fpm -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])

AS_CASE([$host_alias],
[*aix*], [
Expand Down

0 comments on commit 1a126c5

Please sign in to comment.