Fix removal of optimization cflags in debug builds (#9647)

Discard known '-O' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
This commit is contained in:
Arnaud Le Blanc 2024-05-22 13:22:34 +02:00 committed by GitHub
parent c4d9a37e81
commit 182fee1447
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View file

@ -116,8 +116,9 @@ if test "$PHP_DEBUG" = "yes"; then
PHP_DEBUG=1
ZEND_DEBUG=yes
changequote({,})
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'`
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'`
dnl Discard known '-O...' flags, including just '-O', but do not remove only '-O' in '-Ounknown'
CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g'`
CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O\([0-9gsz]\|fast\|\)\([\t ]\|$\)//g'`
changequote([,])
dnl Add -O0 only if GCC or ICC is used.
if test "$GCC" = "yes" || test "$ICC" = "yes"; then