Skip to content

Commit 8fe127a

Browse files
authored
Autotools: Enhance PHP_EVAL_LIBLINE M4 macro (#14924)
PHP_EVAL_LIBALINE macro processes the given libraries flags (-l) and/or library paths flags (-L) and appends the -l flags to either LIBS or the given *_SHARED_LIBADD variables. The -L flags are appended to the LDFLAGS. The new 3rd argument enables appending libraries to the given variable in the 2nd argument without manual setting whether the extension is shared. For example, to simplify usage in SAPIs where additional libraries need to be appended but they shouldn't go to the global LIBS. This can be then used in PHP-FPM SAPI to link apparmor, SELinux, systemd, etc.
1 parent 3703459 commit 8fe127a

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

UPGRADING.INTERNALS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,8 @@ PHP 8.4 INTERNALS UPGRADE NOTES
160160
- PDO extensions in php-src don't have the include flag -I$pdo_cv_inc_path
161161
directory anymore.
162162
- M4 macro PHP_SETUP_OPENSSL doesn't accept the 3rd argument anymore.
163+
- M4 macro PHP_EVAL_LIBLINE got a new 3rd argument to override the ext_shared
164+
checks.
163165
- TSRM/tsrm.m4 file and its TSRM_CHECK_PTHREADS M4 macro have been removed.
164166
- Added pkg-config support to find libpq for the pdo_pgsql and pgsql
165167
extensions. The libpq paths can be customized with the PGSQL_CFLAGS and

build/php.m4

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,21 @@ AC_DEFUN([PHP_REMOVE_USR_LIB],[
341341
])
342342

343343
dnl
344-
dnl PHP_EVAL_LIBLINE(libline, SHARED-LIBADD)
345-
dnl
346-
dnl Use this macro, if you need to add libraries and or library search paths to
347-
dnl the PHP build system which are only given in compiler notation.
348-
dnl
349-
AC_DEFUN([PHP_EVAL_LIBLINE],[
344+
dnl PHP_EVAL_LIBLINE(libline, [libs-variable], [not-extension])
345+
dnl
346+
dnl Use this macro to add libraries and/or library search paths to the PHP build
347+
dnl system when specified in compiler notation. Libraries (-l) are appended
348+
dnl either to the global Autoconf LIBS variable or to the specified
349+
dnl "libs-variable" (e.g., *_SHARED_LIBADD) when the extension is shared
350+
dnl (ext_shared=yes). If "not-extension" is set to a non-blank value, the
351+
dnl libraries are appended to "libs-variable" unconditionally (this is
352+
dnl particularly useful when working with SAPIs). The -L flags are appended to
353+
dnl the LDFLAGS.
354+
dnl
355+
AC_DEFUN([PHP_EVAL_LIBLINE],
356+
[m4_ifnblank([$3], [m4_ifblank([$2],
357+
[m4_warn([syntax], [Missing 2nd argument when skipping extension check])],
358+
[_php_ext_shared_saved=$ext_shared; ext_shared=yes])])
350359
for ac_i in $1; do
351360
case $ac_i in
352361
-pthread[)]
@@ -368,6 +377,7 @@ AC_DEFUN([PHP_EVAL_LIBLINE],[
368377
;;
369378
esac
370379
done
380+
m4_ifnblank([$3], [m4_ifnblank([$2], [ext_shared=$_php_ext_shared_saved])])dnl
371381
])
372382

373383
dnl

0 commit comments

Comments
 (0)