Skip to content

Commit 6d6bf05

Browse files
authored
Autotools: Enable adding a list of paths in PHP_ADD_INCLUDE (php#15777)
This enables adding multiple include paths. For example: PHP_ADD_INCLUDE([ $abs_srcdir $abs_builddir $abs_srcdir/main $abs_builddir/main ], [1]) The 2nd argument "prepend" is now validated at Autoconf compile time instead of the configure time.
1 parent e358634 commit 6d6bf05

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

UPGRADING.INTERNALS

+3
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,9 @@ PHP 8.4 INTERNALS UPGRADE NOTES
200200
- Autoconf macros PHP_NEW_EXTENSION, PHP_ADD_SOURCES, PHP_ADD_SOURCES_X,
201201
PHP_SELECT_SAPI now have the source files and flags arguments normalized so
202202
the list of items can be passed as a blank-or-newline-separated list.
203+
- Autoconf macro PHP_ADD_INCLUDE now takes also a blank-or-newline-separated
204+
list of include directories instead of a single directory. The "prepend"
205+
argument is validated at Autoconf compile time.
203206
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS macro have been removed.
204207
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
205208
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and

build/php.m4

+14-15
Original file line numberDiff line numberDiff line change
@@ -467,21 +467,20 @@ AC_DEFUN([PHP_UTILIZE_RPATHS],[
467467
])
468468

469469
dnl
470-
dnl PHP_ADD_INCLUDE(path [,before])
471-
dnl
472-
dnl Add an include path. If before is 1, add in the beginning of INCLUDES.
473-
dnl
474-
AC_DEFUN([PHP_ADD_INCLUDE],[
475-
if test "$1" != "/usr/include"; then
476-
PHP_EXPAND_PATH($1, ai_p)
477-
PHP_RUN_ONCE(INCLUDEPATH, $ai_p, [
478-
if test "$2"; then
479-
INCLUDES="-I$ai_p $INCLUDES"
480-
else
481-
INCLUDES="$INCLUDES -I$ai_p"
482-
fi
483-
])
484-
fi
470+
dnl PHP_ADD_INCLUDE(paths [,prepend])
471+
dnl
472+
dnl Add blank-or-newline-separated list of include paths. If "prepend" is given,
473+
dnl paths are prepended to the beginning of INCLUDES.
474+
dnl
475+
AC_DEFUN([PHP_ADD_INCLUDE], [
476+
for include_path in m4_normalize(m4_expand([$1])); do
477+
AS_IF([test "$include_path" != "/usr/include"], [
478+
PHP_EXPAND_PATH([$include_path], [ai_p])
479+
PHP_RUN_ONCE([INCLUDEPATH], [$ai_p], [m4_ifnblank([$2],
480+
[INCLUDES="-I$ai_p $INCLUDES"],
481+
[INCLUDES="$INCLUDES -I$ai_p"])])
482+
])
483+
done
485484
])
486485

487486
dnl

0 commit comments

Comments
 (0)