From 00799320ec0684a493a114a10e7e122bc4aba459 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 15 Mar 2024 12:52:29 -0400 Subject: [PATCH] Fix GH-12019: ext/gd/config.m4: don't forget GDLIB_CFLAGS in feature tests In commit 85e5635a, a feature test for the various libgd image formats was added. That test however erroneously omits the GDLIB_CFLAGS (from pkg-config) during compilation. This can lead to build failures and therefore false negatives from the test. Here, we add $GDLIB_CFLAGS to $CFLAGS for the duration of the test. Closes GH-12019 --- NEWS | 3 +++ ext/gd/config.m4 | 3 +++ 2 files changed, 6 insertions(+) diff --git a/NEWS b/NEWS index dd3e7703cd3ed..7c1ccee1c9862 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,9 @@ PHP NEWS . Add some missing ZPP checks. (nielsdos) . Fix potential memory leak in XPath evaluation results. (nielsdos) +- GD: + . Fixed bug GH-12019 (add GDLIB_CFLAGS in feature tests). (Michael Orlitzky) + - Gettext: . Fixed sigabrt raised with dcgettext/dcngettext calls with gettext 0.22.5 with category set to LC_ALL. (David Carlier) diff --git a/ext/gd/config.m4 b/ext/gd/config.m4 index a8b1c76d2d131..42bb64578ce0a 100644 --- a/ext/gd/config.m4 +++ b/ext/gd/config.m4 @@ -150,6 +150,8 @@ dnl or run test insufficient. AC_DEFUN([PHP_GD_CHECK_FORMAT],[ old_LIBS="${LIBS}" LIBS="${LIBS} ${GD_SHARED_LIBADD}" + old_CFLAGS="${CFLAGS}" + CFLAGS="${CFLAGS} ${GDLIB_CFLAGS}" AC_MSG_CHECKING([for working gdImageCreateFrom$1 in libgd]) AC_LANG_PUSH([C]) AC_RUN_IFELSE([AC_LANG_SOURCE([ @@ -180,6 +182,7 @@ int main(int argc, char** argv) { AC_MSG_RESULT([no]) ]) AC_LANG_POP([C]) + CFLAGS="${old_CFLAGS}" LIBS="${old_LIBS}" ])