Skip to content

Commit 54c0c7f

Browse files
committed
Fix --enable-re2c-cgoto check
When the computed goto extension is available to optimize conditional jumps, option --enable-re2c-cgoto adds the -g flag to re2c. In this case the AC_LANG_SOURCE is used instead of the AC_LANG_PROG to not wrap the compilation check program in another main() function. Code is also simplified and help messages updated. This is a compiler-agnostic extension, not only available with GCC. When the check is successful, the -g is added, otherwise not.
1 parent df6d85a commit 54c0c7f

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ PHP NEWS
3030
(Florian Engelhardt)
3131
. Fixed bug GH-14650 (Compute the size of pages before allocating memory).
3232
(Julien Voisin)
33+
. Fixed bug GH-11928 (The --enable-re2c-cgoto doesn't add the -g flag).
34+
(Peter Kokot)
3335

3436
- Curl:
3537
. Deprecated the CURLOPT_BINARYTRANSFER constant. (divinity76)

configure.ac

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -170,31 +170,30 @@ PHP_PROG_RE2C([1.0.3], [--no-generation-date])
170170
PHP_PROG_PHP()
171171

172172
PHP_ARG_ENABLE([re2c-cgoto],
173-
[whether to enable computed goto gcc extension with re2c],
173+
[whether to enable computed goto extension with re2c],
174174
[AS_HELP_STRING([--enable-re2c-cgoto],
175-
[Enable -g flag to re2c to use computed goto gcc extension])],
175+
[Enable re2c -g flag to optimize conditional jumps using computed goto
176+
extension, if supported by the compiler])],
176177
[no],
177178
[no])
178179

179-
AS_VAR_IF([PHP_RE2C_CGOTO], [no],, [
180-
AC_MSG_CHECKING([whether re2c -g works])
181-
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [[
182-
int main(int argc, const char **argv)
180+
AS_VAR_IF([PHP_RE2C_CGOTO], [no],,
181+
[AC_CACHE_CHECK([whether re2c -g works], [php_cv_have_re2c_cgoto],
182+
[AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
183+
int main(void)
183184
{
184-
argc = argc;
185-
argv = argv;
186185
label1:
186+
;
187187
label2:
188-
static void *adr[] = { &&label1, &&label2};
188+
;
189+
static void *adr[] = { &&label1, &&label2 };
189190
goto *adr[0];
190191
return 0;
191-
}
192-
]])],[
193-
AC_MSG_RESULT([no])
194-
],[
195-
AS_VAR_APPEND([RE2C_FLAGS], [" -g"])
196-
AC_MSG_RESULT([yes])
197-
])
192+
}]])],
193+
[php_cv_have_re2c_cgoto=yes],
194+
[php_cv_have_re2c_cgoto=no])])
195+
AS_VAR_IF([php_cv_have_re2c_cgoto], [yes],
196+
[AS_VAR_APPEND([RE2C_FLAGS], [" -g"])])
198197
])
199198

200199
dnl Platform-specific compile settings.

0 commit comments

Comments
 (0)