Skip to content

Commit ae42053

Browse files
authored
Autotools: Refactor PHP_BROKEN_GCC_STRLEN_OPT (#14824)
- Synced CS - Cache variable ac_cv_have_broken_gcc_strlen_opt renamed to php_cv_have_broken_gcc_strlen_opt
1 parent dccc911 commit ae42053

File tree

2 files changed

+11
-16
lines changed

2 files changed

+11
-16
lines changed

build/php.m4

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1284,9 +1284,10 @@ dnl
12841284
dnl Early releases of GCC 8 shipped with a strlen() optimization bug, so they
12851285
dnl didn't properly handle the `char val[1]` struct hack. See bug #76510.
12861286
dnl
1287-
AC_DEFUN([PHP_BROKEN_GCC_STRLEN_OPT], [
1288-
AC_CACHE_CHECK([for broken gcc optimize-strlen],ac_cv_have_broken_gcc_strlen_opt,[
1289-
AC_RUN_IFELSE([AC_LANG_SOURCE([[
1287+
AC_DEFUN([PHP_BROKEN_GCC_STRLEN_OPT],
1288+
[AC_CACHE_CHECK([for broken gcc optimize-strlen],
1289+
[php_cv_have_broken_gcc_strlen_opt],
1290+
[AC_RUN_IFELSE([AC_LANG_SOURCE([[
12901291
#include <stdlib.h>
12911292
#include <string.h>
12921293
#include <stdio.h>
@@ -1302,16 +1303,12 @@ int main(void)
13021303
strcpy(s->c, "foo");
13031304
return strlen(s->c+1) == 2;
13041305
}
1305-
]])],[
1306-
ac_cv_have_broken_gcc_strlen_opt=yes
1307-
],[
1308-
ac_cv_have_broken_gcc_strlen_opt=no
1309-
],[
1310-
ac_cv_have_broken_gcc_strlen_opt=no
1311-
])])
1312-
if test "$ac_cv_have_broken_gcc_strlen_opt" = "yes"; then
1313-
CFLAGS="$CFLAGS -fno-optimize-strlen"
1314-
fi
1306+
]])],
1307+
[php_cv_have_broken_gcc_strlen_opt=yes],
1308+
[php_cv_have_broken_gcc_strlen_opt=no],
1309+
[php_cv_have_broken_gcc_strlen_opt=no])])
1310+
AS_VAR_IF([php_cv_have_broken_gcc_strlen_opt], [yes],
1311+
[AS_VAR_APPEND([CFLAGS], [" -fno-optimize-strlen"])])
13151312
])
13161313

13171314
dnl

configure.ac

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,7 @@ AC_CHECK_HEADERS(m4_normalize([
445445

446446
PHP_FOPENCOOKIE
447447
PHP_BROKEN_GETCWD
448-
if test "$GCC" = "yes"; then
449-
PHP_BROKEN_GCC_STRLEN_OPT
450-
fi
448+
AS_VAR_IF([GCC], [yes], [PHP_BROKEN_GCC_STRLEN_OPT])
451449

452450
dnl Detect the headers required to use makedev, major, and minor.
453451
dnl Autoconf <= 2.69 didn't check glibc 2.25 deprecated macros in sys/types.h.

0 commit comments

Comments
 (0)